Hi I have an issue while using PDO, I am new to this. The query return null array if I using the first method:
try {
$r = "SELECT * FROM `order` WHERE `id` = :id AND `key` = :key LIMIT 1";
$r_do = $db->prepare($r);
$r_do->bindParam(':id', $id, PDO::PARAM_STR);
$r_do->bindParam(':key', $key, PDO::PARAM_STR);
$r_do->execute();
$f2 = $r_do->fetch();
} catch(PDOException $r) {
$log->logError($r." - ".basename(__FILE__));
}
where $id is integer and $key is an ecrypted string e.g iGkGNI1NEzCZ6k9g9xC+m8hNm22G3DXsNoEqdwNkTc0=
The value come from an URL
signin.php?id=10&key=iGkGNI1NEzCZ6k9g9xC+m8hNm22G3DXsNoEqdwNkTc0=
If i directly replace the prepared statement with it value, the query will return the result.
$r = "SELECT * FROM `order` WHERE `id` = '10' AND `key` = 'iGkGNI1NEzCZ6k9g9xC+m8hNm22G3DXsNoEqdwNkTc0=' LIMIT 1";
Any idea? For your info I am using Webmatrix as IDE with PHP on Windows 7 64-bit
var_dump($key)? With+and=in the text, it might be being converted for you somewhere along the way.+was? You need to run the code throughurlencode()on the page where you're generating the link; andurldecode()on this page: php.net/manual/en/function.urlencode.php