I'M trying to output a message if the PHP query on the MySQL database come back empty. But when I uncomment this line //echo "No result found for entry";
not only does it fail to output this message when there is no match but it also fails to load the page at all. If this line is un commented I get nothing but a solid white page. PHP code is below. Any ideas?
<?php
// get variable from html form
$fName = $_POST['fname'];
$lName = $_POST['lname'];
$address = $_POST['address'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$state = $_POST['state'];
// Create connection
$con=mysqli_connect("localhost", "garrett", "xyz", "bailbond");
// Check connection
if(mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con, "SELECT * FROM people WHERE fname='$fName' or lname='$lName' or address='$address'");
if(!$result)
{
//echo "MySQL Error: " . mysqli_error($con) . "\n";
//echo "No result found for entry";
}
else
{
while($row = mysqli_fetch_array($result))
{
echo $row['fname'] . " " . $row['lname'] . " " . $row['address'] . " " . $row['city'] . " " . $row['state'] . " " . $row['zip'];
echo "<br /> <br />";
}
}
?>