Reply to Re: Saving a result to another table

Your name:

Reply:


Posted by jerry gitomer on 05/17/05 15:26

maceo wrote:
> I have a script that will print out the results of a table and make a
> calculation of a total of one of the columns. See example:
>

[ big snip ]
>
> What I want to do is take the result ($time) and save it to another
> table, along with the name and id# of the pilot. I then want to call
> from that table and print out the top 5 based upon flight times.
>
> I have tried to store to a second table (tmp), by using code to this
> script that appears after the $time calculation:
>
> [code:1:4d5f0e55d2]
>
> $sql = "INSERT INTO tmp (mxpid,time,name) VALUES
> ('$num','$time','$name')";
>
> $query = "SELECT * FROM tmp ORDER BY time DESC";
> $result = mysql_query($query);
> $number = mysql_numrows($result);
>
> if ($number > 0) {
> for ($i=0; $i<$number; $i++) {
> $mxpid = mysql_result($result,$i,"mxpid");
> $name = mysql_result($result,$i, "name");
> $totaltime = mysql_result($result,$i,
> "time");
> [/code:1:4d5f0e55d2]
>
> but this is not working.....getting a parsing error and the data is
> not stored in the new table.
>
> Any ideas how to do this better?
>
> Thanks
>


Based on the code you listed you are not executing your INSERT
statement.

HTH
Jerry

[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

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