connect_error) { echo "

Connection Error!

"; die ($conn->error); }else{ // query the database $myQuery = "select elevation from eastern where name='$areaName'"; $result = $conn->query($myQuery); if ($result->num_rows == 0) { // no match echo "0"; die($conn->error); } else if ($areaName=="Loon") { // Here you would pull out the image from the matching record. // This is simulated (hardcoded) here. echo ''; } else if ($areaName=="Cannon") { echo ''; } } ?>