I am currently working on pagination related to products. Each row has its own ID number. One column has a button with an ID number that allows me to see more information about products using a "pid" number which is like an ID number.
The button I put in the code is like this:
In the preview-print.php page I am getting an error that says:
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, a boolean given in line 25 which is:
$sql = new mysqli($mysql_hostname, $mysql_user, $mysql_password, $mysql_database);
if (isset($_GET['pid'])) {
$targetID = $_GET['pid'];
$query = "SELECT * FROM product WHERE product_id='$targetID' LIMIT 1";
$result = mysqli_query($sql,$query);
while($row = mysqli_fetch_array($result)){
$product_id = $row["product_id"];
$product_name = $row["product_name"];
$product_category = $row["product_category"];
$product_retail_price = $row["product_retail_price"];
$product_price = $row["product_price"];
$screenshot =$row["screenshot"];
$images_2=$row["images_2"];
$images_3=$row["images_3"];
$images_4=$row["images_4"];
$images_5=$row["images_5"];
}
}
mysqli_close($sql);
?>
Can anyone help me find what I am missing and how I can solve it?
No comments:
Post a Comment