Reply to Help with COUNT() on a php form

Your name:

Reply:


Posted by bigsamurai on 01/10/06 17:23

Good day... I have included the code of a form that i am trying to get
to work. The object of the form will be to show a person the number of
flight hours they have and the number of flights that they have
accomplished. However I am getting an error saying that the result can
not be found. PLZ HELP as I am pullingm y hair out and do not have
much left to begin with.!!!




$query = "SELECT mission.miss_pilot_assign,
pilot.pilot_no, pilot.pilot_name,
mission.miss_status,
mission.miss_no,
mission.miss_hours
FROM mission, pilot
WHERE
mission.miss_pilot_assign=pilot.pilot_no
AND
mission.miss_status=3
AND
pilot.pilot_name='$_POST[pilot_name]'
GROUP
by mission.miss_status";


$result=@mysql_query($query);

$number = mysql_numrows($result);

if ($number > 0) {
print "<h2> Here are the flight statistics for '$_POST[pilot_name]'as
recorded by Squadron Operations. <br /><br /><br /></h2>";

print "<table>";

print "<tr>";
print "<td bgcolor=000000 width=80 height=25 align=center><font
face=Arial color=#FFFFFF size=2><b>Number of missions</b></font></td>";
print "<td bgcolor=000000 width=120 height=25 align=center><font
face=Arial color=#FFFFFF size=2><b>Number of Hours</b></font></td>";
print "</tr>";

/* Get pilots info */
for ($i=0; $i<$number; $i++) {
$miss_tot = mysql_result($result,$i,"(COUNT(miss_no))");
$hours_tot =
mysql_result($result,$i,"(SUM(miss_hours))");



/* Display roster entries */
print "<tr>";
print "<td bgcolor=000000 width=90 height=20 align=left><font
face=Arial size=2 color=#FFFFFF>$miss_tot</font></td>";

print "<td bgcolor=000000 width=90 height=20 align=left><font
face=Arial size=2 color=#FFFFFF>$hours_tot</font></td>";
print "</tr>";
}

print "</table>";
}




/* Close the database connection */
mysql_close();
?>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация