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(1, $name);
I wanted to do this:
$stmt = $dbh->prepare("SELECT * FROM REGISTRY where firstname = ? or lastname = ?");
with both '?' representing the same string.
Try...
$stmt = $dbh->prepare("SELECT * FROM registry WHERE firstname = :name OR lastname = :name;");
$stmt->bindParam(':name', $name);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With