connect_error) { die("Connection failed: " . $link->connect_error); } foreach ($productIDs as $id) { $query = "SELECT * FROM `" . SHOP_ID . "_product` WHERE `id` = ?"; $stmt = $link->prepare($query); $stmt->bind_param("i", $id); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { for ($i = 0; $i < $row['stock']; $i++) { echo '

'.$row['name'].'

Price:'.$row['price'].'

'; } // echo ' Price:'.$row['mrp'].''; ?> JsBarcode(\"#code".$row['id']."\", \"" . $row['id'] .'-' .$row['cat']. "\", {width: 1.4, height: 30, displayValue: true, fontSize: 10});"; } } else { echo "No product found with ID: " . $id . "
"; } } $stmt->close(); $link->close(); ?>