I am trying to check if row exists. I am getting
Commands out of sync; you can't run this command
I am getting this error because I added $stmt->store_result(); if I remove that line num_rows doesn't return true. How can I check if the row exists?
$title = urldecode($_GET['product-tit/']);
$id = $_GET['item-id-pr'];
$mydb = new mysqli('localhost', 'root', '', 'database');
if(empty($title) || empty($_GET['item-id-pr'])){
header('Location: products.php');
exit();
}
else{
$stmt = $mydb->prepare("SELECT * FROM products where title = ? AND id = ? limit 1 ");
$stmt->bind_param('ss', $title, $id);
$stmt->execute();
$stmt->store_result();
?> 
<div>
<?php
if($stmt->num_rows < 1 )  {
     echo "not found";
     exit();
    } else{
$result = $stmt->get_result();
 echo $mydb->error;
 while ($row = $result->fetch_assoc()) {
echo wordwrap($row['price'], 15, "<br />\n", true); 
     exit();
}
$mydb->close ();}}
?>
</div>
 
    