trying to limit a PDO Mysql query getting errors.

I want to limit this to 6 but every time I add LIMIT 6 at the end I get this error:

Parse error: syntax error, unexpected T_STRING in /var/www/html/beta/includes/index.php on line 38
It has something to do with the line:
                                                WHERE movie_actor.movie_id = ".$dbh->quote($movie_recent['movie_id'])

I was putting it  right after it but that breaks it.
<?
$movie_actor = $dbh->query("SELECT	act.actor_name
									FROM movie_actor
									LEFT JOIN actor act on act.actor_id = movie_actor.actor_id
									WHERE movie_actor.movie_id = ".$dbh->quote($movie_recent['movie_id'])
									
									);
?>

Open in new window

LVL 3
jbrashear72Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lashamCommented:
<?
$movie_actor = $dbh->query("SELECT      act.actor_name
                  FROM movie_actor
                  LEFT JOIN actor act on act.actor_id = movie_actor.actor_id
                  WHERE movie_actor.movie_id = ".$dbh->quote($movie_recent['movie_id']) . " LIMIT 0,6"
            
            );
?>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jbrashear72Author Commented:
It wasn't working till I tried:
<?
$movie_actor = $dbh->query("SELECT      act.actor_name
                  FROM movie_actor
                  LEFT JOIN actor act on act.actor_id = movie_actor.actor_id
                  WHERE movie_actor.movie_id = ".$dbh->quote($movie_recent['movie_id']) . " LIMIT 6"
           
            );
?>
0
lashamCommented:
What do you mean "It wasn't working till ...." ?

write what was the result?

1) " LIMIT 0,6 " -  it have to return result with first six rows
2) " LIMIT 6 "    - is the same as (1)


0
jbrashear72Author Commented:
It was not returning any records as if the 0    in 0,6 was only being read.

Very strange.
0
lashamCommented:
<?
$movie_actor = $dbh->query("SELECT      act.actor_name
                  FROM movie_actor
                  LEFT JOIN actor act on act.actor_id = movie_actor.actor_id
                  WHERE movie_actor.movie_id = ".$dbh->quote($movie_recent['movie_id']) . " LIMIT 1,6"
           
            );
?>

check this and check result again
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.