views:

24

answers:

1

I've exhausted all efforts at what appears to be a trivial problem, but gotten nowhere.

There is a simple Prepare statement:

$qry = $core->db->prepare("SELECT * FROM users WHERE email = '?'");
$qry->execute(array('[email protected]'));

However, no rows are returned. Running the query with the parameters hardcoded into the query results in a successful selection of one row. I've tryed many different methods of doing the prepare, but even it this most simple form it isn't working.

The PDO object is stored in a singleton called Core. PDO is using the mysql driver.

+3  A: 

Remove quotes from the query:

("SELECT * FROM users WHERE email = ?");

The reason to use placeholders (? symbol) is to forget about quotes. PDO will add them automatically.

Ivan Nevostruev
Oh god, I didn't even notice that. This was more of a brainteaser. +1
ryeguy
*sigh* I must have tryed everything except this. Thanks :)
Danten