Here is my partial code:
if ($dbh) {
#print "it works <br>";
}
my $sql = "SELECT `fname` FROM students WHERE user_id = '$username' ";#SELECT * FROM `location` LIMIT 0 , 30
my $query=$dbh->prepare("$sql");
if (defined($query)) {
$query->execute();
}else {
print "could not execute the query <br>";
}
I need for the error message "could not execute the query <br>"; to display if the $username does not exist, in other words if the db cant be opened.
Right now if the user enters a wrong username the page result is just blank.
Thanks for any help.