|
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
Navigation:
[Reply to this message]
|