Reply to Re: Help with COUNT() on a php form

Your name:

Reply:


Posted by Jim Michaels on 01/11/06 10:52

since you are using mysql_fetch_array you can always use column names
instead of column numbers for an index into the row array. mnemonics are
easier to read and debug.

"J.O. Aho" <user@example.net> wrote in message
news:42ih3fF1ieremU1@individual.net...
> bigsamurai wrote:
>> now i get this error...
>>
>> Warning: mysql_result(): supplied argument is not a valid MySQL result
>> resource in /home/content/m/i/k/mikey05156/html/ind_pilotins.php on
>> line 48
>>
>> Warning: mysql_result(): supplied argument is not a valid MySQL result
>> resource in /home/content/m/i/k/mikey05156/html/ind_pilotins.php on
>> line 49
>>
>> line 48 and 49 are as follows:
>>
>>
>> $miss_tot = mysql_result($result1,$i,"(miss_no)");
>> $hours_tot = mysql_result($result1,$i,"(miss_hours)");
>>
>>
>> I put the select statement you provided as a second. using the $query1
>> and $result1 variable.
>>
>
> $row=mysql_featch_arrya($result1)
>
> $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 */
> while($row=mysql_fetch_array($result)) {
> print "<tr>";
> print "<td bgcolor=000000 width=90 height=20 align=left><font
> face=Arial size=2 color=#FFFFFF>".$row[4]."</font></td>";
> $tot_miss+=$row[4];
>
> print "<td bgcolor=000000 width=90 height=20 align=left><font
> face=Arial size=2 color=#FFFFFF>".row[5]."</font></td>";
> print "</tr>";
> $tot_hours+=$row[5];
>
> }
>
> print "<tr>";
> print "<td bgcolor=000000 width=90 height=20 align=left><font
> face=Arial size=2 color=#FFFFFF>$tot_miss</font></td>";
>
> print "<td bgcolor=000000 width=90 height=20 align=left><font
> face=Arial size=2 color=#FFFFFF>$tot_hours</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

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