I have tried ready various articles to resolve the issue to no avail. I using a form to post data to my php file. Then I'm trying to find the row that has the matching value. I keep getting these errors: Undefined index: barcode & Trying to get property of non-object Can someone help me resolve this issue?
//barcode is serialized data from a form and equals 'barcode=2147483647'
$barcode = $_GET['barcode'];
$sql = "SELECT id FROM the_DB WHERE barcode = '%$barcode%'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo 'id:' . $row["id"]. '<br>Name: ' . $row["item_name"]. '<br> Barcode ' . $row["barcode"]. '<br><img src="'.$row["image"].'" height="100px">';
}
} else {
echo "0 results";
}