MySQLI Prepared Statement Not Binding Properly
- by Sev
Any reason why the following code won't work?
$dbconnection = db::getInstance(); //this is a singleton db class
$stmt = $dbconnection->prepare("SELECT `id` from `table` where `username`=?");
$stmt->bind_param("s", $username);
$stmt->execute();
$stmt->bind_result($uid);
$stmt->fetch();
echo $uid;
The same connection method is used elsewhere, and it works there. The only difference on that other page where it works, is that there are multiple rows fetched, not just one.