digitai
digitai

Reputation: 1842

mysql php PDO query multiple AND

I want to execute the following query on mysql DB, using PHP-PDO.
SELECT count(id) FROM view_id WHERE id=@id and id_a='1' and id_b='1' and id_c='3' and id_d='2' However when I run on the database it executes nice, and gives me a result. But when executing with php - PDO it gives error, by the way no error message, just stops the webpage deployment. Any help is really appreciated.

Thanks,

Upvotes: 0

Views: 108

Answers (1)

Peter Geer
Peter Geer

Reputation: 1162

It's hard to be sure without seeing the actual code used to call it, but right off, you have the wrong parameter marker in yoru SQL. PDO uses a colon for named parameter, e.g. "id=:id". You have an at symbol, which could cause the problem.

As for the error reporting, check that your error mode is set to something sensible.

Upvotes: -2

Related Questions