Hello all,
I’m transitioning into mysqli, and seem to be missing a few details. I keep getting the following error message:
mysqli_error() expects parameter 1 to be mysqli, 0 given in …path/… on line 222
[php]
//$conn(ection) works fine in previous queries in same page
$conn=dbConnect(‘query’);
if($top_gun_id) {
//get specs from db using foreign key
$sqli = “SELECT * FROM great_movies WHERE top_secret_info.top_gun = $top_gun_id”; /*where top_secret_info is another table */
//the following is the line (222) in question
$get_gun = $conn->query($sqli) or die(mysqli_error());
$alt_row = $get_gun->fetch_assoc();
while($alt_row) {
echo "$alt_row\r\r";
}
//do x,y, and even z
}
[/php]
After much reading, I can’t find anything conclusive, but have the impression that if you’re only reading from a db and not inserting, mysqli does not require a prepared statement ? Is that my whole problem? Should $sqli read:
[php]$sqli = 'SELECT * FROM great_movies WHERE ? = ?[/php]
and so on? I feel like I’ve tried that too, but can’t remember anymore.
One last thing, I typed: [php]or die(mysqli_error($get_gun)[/php]
and received: mysqli_error() expects parameter 1 to be mysqli, boolean given in …path/… on line 222
Thanks in advance.