note 76138 deleted from pdostatement.bindparam by danbrown
| From: | danbrown@php.net | Date: | Tue, 17 May 2011 18:10:56 +0000 |
| Subject: | note 76138 deleted from pdostatement.bindparam by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179832@lists.php.net to get a copy of this message | ||
Note Submitter: m dot van dot urk at comsi dot nl
----
You can't bind a table name in the query.
So the following code isn't working:
$a = 'klanten';
$sQuery = "SELECT COUNT(*) FROM ? WHERE email = 'info@site.uk' AND wachtwoord =
'welcome'";
$rResult2 = $login->db->prepare($sQuery);
$rResult2->bindValue(1, $a);
$rResult2->execute();
}
catch (PDOException $e) {
die( $e-getMessage());
}
if ($rResult2->fetchColumn() == 0) {
echo 'false';
} else {
echo 'true';
}