I have this code which i added an if statement to check to see if the number of rows is empty from the $query, I want to echo out a message.
I tired php.net for mysql_num_rows but could not find a good example
$query = "SELECT * FROM `students` WHERE `registered` = 0" ;
$r = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array ($r))
{
if (mysql_num_rows($row) == 0)
{
echo "All Students are either Registered or Have a teacher assigned";
}
echo "<tr>\n";
echo "<td style=\"font: bold; color: #000000; background: #FFFF00\">{$row['student_fname']} {$row['student_lname']}</td>\n";
echo "<td style=\"font: bold; color: #000000; background: #FFFF00\">{$row['student_bdate']}</td>\n";
echo "<td style=\"font: bold; color: #000000; background: #FFFF00\">{$row['student_age']}</td>\n";
echo "<td style=\"font: bold; color: #000000; background: #FFFF00\">{$row['student_address1']}<br />{$row['student_city']}, {$row['student_state']} {$row['student_zip']}</td>\n";
echo "<td style=\"font: bold; color: #000000; background: #FFFF00\">{$row['student_father']}</td>\n";
echo "<td style=\"font: bold; color: #000000; background: #FFFF00\">{$row['student_mother']}</td>\n";
echo "<td style=\"font: bold; color: #000000; background: #FFFF00\" >{$row['student_contact']}</td>\n";
echo "<td style=\"font: bold; color: #000000; background: #FFFF00\"><a href=\"mailto:{$row['student_email']}\">{$row['student_email']}</a></td>\n";
echo "<td style=\"font: bold; color: #000000; background: #FFFF00\">{$row['student_allergies']}</td>\n";
echo "<td style=\"font: bold; color: #000000; background: #FFFF00\"><a href=\"edit_student.php?id={$row['student_id']}\">Edit</a> <a href=\"delete_student.php?id={$row['student_id']}\">Delete</a></td>\n";
echo "</tr>\n";
}
echo "</table>\n";
I hope that I am making it clear on what I am trying to accomplish!