check to see if the search was successful or not

This commit is contained in:
Bryan
2019-12-04 19:26:24 -05:00
parent 3f9787538a
commit 5cebb420eb
2 changed files with 10 additions and 2 deletions

View File

@@ -24,7 +24,11 @@ $query = "Select * from contacts where fname = '".$_POST["fname"]."' and lname =
foreach($db_connection->query($query) as $row){
if(empty($row){
print("There is no user with that first and last name");
else{
print "First Name:".$row['fname']." Last Name:".$row['lname']." Username:".$row['username']."\n";
}
}
?>

View File

@@ -21,8 +21,12 @@ echo "<br>";
$query = "Select * from contacts where username = '".$_POST["username"]."'";
foreach($db_connection->query($query) as $row){
print(empty($row)."\n");
print $row['username']." First Name:".$row['fname']." Last Name:".$row['lname']."\n";
if(empty($row){
print("There is no user with that name");
}
else{
print $row['username']." First Name:".$row['fname']." Last Name:".$row['lname']."\n";
}
}
?>