[Solar-talk] Disturbing Solar_Sql_Select problem
Paul M Jones
pmjones at ciaweb.net
Sun Feb 25 09:56:35 PST 2007
On Feb 25, 2007, at 11:51 AM, Rodrigo Moraes wrote:
> Hi,
> I'm a little lost with the exception "Invalid parameter number: no
> parameters were bound" which is thrown when the parameter has a single
> quote. I'm converting an old database and have a query like this one:
>
> $title = 'TONY HAWK\'s PROJECT 8';
> $select = Solar::factory('Solar_Sql_Select');
> $res = $select->from('games_game', '*')
> ->where('title = ?', $title)
> ->fetch('one');
>
> And, *sometimes yes, sometimes not*, it generates the exception:
> ...
> [pdo_text] => SQLSTATE[HY093]: Invalid parameter number: no
> parameters were bound
> ...
> [stmt] => SELECT
> games_game.*
> FROM games_game
> WHERE
> title = 'TONY HAWK\'s PROJECT 8'
> LIMIT 1
>
> What is wrong with the query above? It's disturbing that it fails only
> sometimes, and I thought it could be something related with the
> windows PDO driver... but maybe I should do this query differently?
Which version of PHP? There are some (quite drastic) differences in
binding between PHP 5.2.0 and 5.2.1 that I've addressed in the
"model" branch and will bring back to "trunk" soon. Will explain
more at that time.
Also, if you try it directly with a PDO object proper, does it throw
the same exception?
--
Paul M. Jones <http://paul-m-jones.com>
Solar: Simple Object Library and Application Repository
for PHP5. <http://solarphp.com>
Join the Solar community wiki! <http://solarphp.org>
Savant: The simple, elegant, and powerful solution for
templates in PHP. <http://phpsavant.com>
More information about the solar-talk
mailing list