MySQLI Prepared Statement Not Binding Properly

Posted by Sev on Stack Overflow See other posts from Stack Overflow or by Sev
Published on 2010-05-27T21:27:26Z Indexed on 2010/05/27 21:31 UTC
Read the original article Hit count: 142

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about php

Related posts about mysqli