In simple data to fetch,working correctly but if something not found then not throwing message.It means if i search for something and found it will fetch, but if not nothing returned on screen, while i want display 'nothing found' message .Please help:
$email= $_GET['email'];
$a = $conn->prepare("SELECT `id` FROM `userdata` WHERE `diary`=?");
$a->bind_param("s", $email);
$a->execute();
$res = $a->get_result();
if ($res->num_rows > 0) {
while ($row = $res->fetch_assoc()) {
echo $row['id'];
}
} else {
echo'Nothing found';
}
// Close the prepared statement.
$a->close();
$conn->close();