Not sure what I am doing wrong. I’m learning
I expect the below code to find one business by id and see if the businesses zip code is found in Florida_Zips column and display the resulting image. It should find one entry, but finds nothing and no errors are being displayed :
URL is called like this: test.php?id=1234&Business_Zip=56789
Thank you very much to anyone kind enough to help me!
<?php
if (isset($_GET['id'], $_GET['Business_Zip']))
{
$con=mysqli_connect("localhost","*****","*****","*****");
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$id = ($_GET['id']);
$Florida_Zips = ($_GET['Florida_Zips']);
$Business_Zip = ($_GET['Business_Zip']);
$result = mysqli_query($con,"SELECT * FROM DATA WHERE '$Business_Zip' LIKE '$Florida_Zips' AND id = " . $_GET['id']);
while($row = mysqli_fetch_array($result))
{
echo '<br><img src="images/Florida.png" style="padding-bottom:8px;">';
}
mysqli_close($con);
}
?>