Odd PDO issue with 'limit'

I’m asking it here since this seems to be more of a PDO issue than a mySQL one. I’ve got this query set up using pdo’s prepare/execute:

	SELECT * FROM '.$db->tablePrefix.'blogPosts
	WHERE blogId = :blogId
	LIMIT :start , :count
	':blogId' => $data['action'][1],
	':start' => $data['action'][2],
	':count' => 3

Doesn’t work, and if I print_r $qHandle->errorInfo() after it, I get the following:

[0] => 42000
[1] => 1064
[2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘‘5’ , ‘3’’ at line 3

… and yes, all three values assigned to the array are correct – the first two $data are currently being tested with ‘1’

Is there some special syntax you have to pass values to ‘limit’ in when using PDO?

If I manually plug in the values in the prepare it’s fine… and if I insert them into the query string they’re fine so I know it’s not the normal mySQL syntax causing problems. At first I thought this was a typecasting issue, but forcing (int) before each value did nothing… Thought maybe it was my using single quotes to build the query, but that’s not it either. Was thinking maybe namespace on :count, but that wasn’t it…

Anyone got a clue as to my problem? I’ve never had a prepeared query bomb on something as simple as this before.

Nevermind, it WAS a typecasting issue and one that makes it so you can’t use an array OR bindParam – it HAS to be bindValue and you both have to use that method’s typecasting AND send it a typecast value.

So my ‘fixed’ version ended up reading:

	SELECT * FROM '.$db->tablePrefix.'blogPosts
	WHERE blogId = :blogId
	LIMIT :start , :count


Annoying, but it works. Gah, I really wish php was strictly typecast.

Gah, I really wish php was strictly typecast.

amen, brother.
php wants to be object oriented, but also wants dynamic typecasting with no option to cast string or int. If you want a good laugh try this

function string( string $string ){
    return $string;
string('a string');

read the error message :weyes: