Hey all,
I'm trying to get my head around prepared statements and not having much luck (see code sample below). It seems the mysqli_prepare isn't happening but I've no idea why... Any help grately appreciated as this is driving me nuts and I've probably done really stupid 🙂
Probably should mention I'm using PHP 5.0.4
MY CODE
$link = mysqli_connect($dbhost,$dbuser,$dbpass,$dbname,$dbport);
if (!$link) {
print "Couldn't open DB";
exit();
}
// prepare the select statement ...
$strSql = "SELECT * FROM tbl_a7_a5_story_code WHERE codeid= ?";
if ($prepSql = mysqli_prepare($link,$strSql)) {
mysqli_stmt_bind_param($prepSql, 'i', $loopVar);
for ($loopVar=1; $loopVar < 50; $loopVar++) {
mysqli_stmt_execute($prepSql);
[ .. more stuff in here but it's immaterial at the mo ..]
}
} else {
print "the prepare didn't work";
}
END OF MY CODE