I am learning how to use prepared statements with php 5 mysqli objects and I am having trouble getting the basic result binding to work. I am following the example code from php.net but something isn't working, the bound results are always NULL. Here is what I have
/* prepare statement */
if ($stmt = $DB->mysqli->prepare("SELECT `alias`,`nameFirst`,`nameLast`,`email`,`access_level` FROM `users` WHERE `alias` LIKE CONCAT('%',?,'%') LIMIT 20;")) {
$stmt->bind_param('s',$alias);
$stmt->execute();
/* bind variables to prepared statement */
$stmt->bind_result($col1, $col2);
/* fetch values */
while ($stmt->fetch()) {
echo "COL 1=".$col1." | COL2=".$col2."<br />";
}
/* close statement */
$stmt->close();
} else echo "NO DICE";