I am looking for help with resolving this issue. For some reason when I go to query my database using this code, I get these error messages.
Warning: mysqli_stmt: execute() invalid object or resource mysqli_stmt
Warning: mysqli_stmt: bind_result() invalid object or resource mysqli_stmt
Warning: mysqli_stmt: fetch() invalid object or resource mysqli_stmt
Warning: mysqli_stmt: close() invalid object or resource mysqli_stmt
Code:
<?php
$mysqli = new mysqli("localhost", "root", "","sampleprojects");
$query = "SELECT productid, name, price, description FROM product ORDER BY porductid";
$stmt = $mysqli->stmt_init();
$stmt->prepare($query);
$stmt->execute();
$stmt->bind_result($productid, $name, $pric, $description);
while($stmt->fetch()){
echo "$productid, $name, $price, $description <br />";
}
$stmt->close();
$mysqli->close();
?>
The thing about it is that when I use the mysqli class to insert data everything goes fine, but it is only when I go to use the mysqli class to query the database(extract info) that everything goes crazy. Any help is greatly appreciated.