WHERE clause confusion with PDO
- by Greg
I'm having some trouble understanding how to use prepared statements, when you need to match one value against several columns at once.
In other words what instead of doing this:
$stmt = $dbh-prepare("SELECT * FROM REGISTRY where name = ?");
$stmt-bindParam(':name', $name);
I wanted to do this:
$stmt = $dbh-prepare("SELECT * FROM REGISTRY where firstname = ? or lastname = ?");
with both '?' representing the same string.