Ok so I am trying to make it so that if the input username exists to fetch the details for that username, and if no username exists to tell me so…
So far it will tell me if the username exists, but not if it does not exist…
So basically if the query returns zero results how do I get it to say “hey there were no matches” ?
my code so far…
$user = $_POST['txtUsername'];
$sql = "SELECT * FROM `weaponstreat` WHERE username='$user'";
$rows = $db->query($sql); while ($record = $db->fetch_array($rows)) {
if ($record['tid'] === NULL) { echo "empty"; } else { echo "full"; }
}
1 Answer