Re: Table sorting with PHP/MySQL
| From: | Simon Steed | Date: | Tue, 30 May 2000 13:29:43 +0000 |
| Subject: | Re: Table sorting with PHP/MySQL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-626@lists.php.net to get a copy of this message | ||
Hi,
Thanks for the code. A problem seems to be the line 'while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {' where it throws up an error
Parse error: parse error in /home/testsour/html/mysql/tips/admin.php3 on line 357 which is of course the above mentioned line
Not very descriptive! To be honest, I am not sure how it is supposed to work i.e. what does MYSQL_ASSOC do? I can sorta follow it so far then !!!!!!!
Regards
Simon
At 12:04 30/05/00 +0100, you wrote:
How should I do this? How about something along the lines of...$result = MYSQL_QUERY("SELECT * FROM keyword ORDER BY id");// Header stuff goes here.// Get results & output to browser.. Note that Id is assumed to be >=0 for thisto work..$last_id = -1; while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { if ($last_id != $row["id"]) { if ($last_id >= 0) echo "</td></tr>\n"; echo "<tr><td valign='top' align=center>"; echo $row["id"]; echo "</td><td valign='top' align=center>"; $last_id = $row["id"]; }; echo $row["word"] ." "; }; if ($last_id >= 0) echo "</td></tr>\n"; echo "</table>\n";// End stuff..