Hi I have the following query, but if no records are returned I want to echo out the appropriate message, but it doesn't work.
Can anyone help?
thankyou
$link_id = db_connect();
$query = "SELECT * FROM tblstaff;";
$result = mysql_query($query);
if(!$result) error_message(sql_error());
while ($myrow = mysql_fetch_array($result)) {
echo " <option value='". $myrow[staffID] ."'>" . $myrow["staffFirstName"] . " " . $myrow["staffSurname"] . "</option>";
}
else{
echo "no staff present";
}