Hi...
I've got a strange problem and I can't see where it is.
I have my code below for reference.
When I run this code, I'm expecting a "0" (zero) result from the $num_360th variable. I'm getting nothing at all. No number, no nothing.
I was under the understanding that a mysql_num_rows function would yeild an integer result... 0 if it didn't find anything based on the query, and a number greater than 0 if it did find something based on the query.
The query below is SUPPOSED to not find anything... and as a result supposed to yeild a result of 0.
Anyone have any ideas? I'm stumped... 🙁
<?php
// Define Variables //
$db_name = "database";
// Connect to Database //
$connect = @mysql_connect("localhost", "username", "password") or die(mysql_error());
$db = @mysql_select_db($db_name, $connect) or die(mysql_error());
// Create MISSION variable Query //
$mis = "SELECT MAX(mission_no) FROM mission";
$mis_result = @mysql_query($mis, $connect) or die(mysql_error());
while ($row = mysql_fetch_array($mis_result)) {
$mission = $row['MAX(mission_no)'];
}
$check = "SELECT percentage FROM mission WHERE mission_no = '$mission' AND plane_squadron = '360th'";
$check_result = @mysql_query($check, $connect) or die(mysql_error());
$num_360th = mysql_num_rows($check_result);
echo "<font face=\"Century Gothic\" size=2 color=red><b>ERROR CHECK (num_360th variable) = </b><font color=black>$num_360th</font></font><br>";
echo "<font face=\"Century Gothic\" size=2 color=red><b>ERROR CHECK (mission) = </b><font color=black>$mission</font></font>";
?>