Hi, I bought a script and although it seems to be working properly for the most part, it does have it's glitches. It's a "linkexperiment" script and it's supposed to display the links in the database by Amount (highest to lowest) and then by the order in which it was entered (first to last) I've looked at the database and the information stored is link_id description website amount in a table called link_data_tb It is sorting by amount but other than that I can't figure out what it's sorting by.... but it's not link_id The code is <?php $rs = @mysql_query("select * from link_data_tb order by amount desc"); $cnt = 0; while($row = @mysql_fetch_array($rs)) { ?> <tr> <td valign="top" align="right"><?php print $cnt+1; ?></td> <td valign="top" nowrap><a href="<?php print $row['website']; ?>" target="_blank"><?php print stripslashes($row['description']); ?></a></td> <td valign="top" align="right"><?php print "$".$row['amount']; ?></td> </tr> <?php $cnt++; } if($cnt==0) print "<tr><td align='center' style='color: #cc0000' colspan='5'>No data found....</td></tr>" ?> Code (markup): I tried changing the first line of that to be ... $rs = @mysql_query("select * from link_data_tb order by amount link_id"); Code (markup): but then I get "no data found" I would greatly appreciate any suggestions or assistance anyone could offer - it seems "logical" to me but it's not working the way "I" think it should work. Thanks in advance Lisa
$rs = @mysql_query("select * from link_data_tb order by link_id ASC"); sorts by link id (first to last) I think the following will also do the same: $rs = @mysql_query("select * from link_data_tb"); Bye
Thanks Jeet - I actually figured it out and what I needed was to do this... $rs = @mysql_query("select * from link_data_tb order by amount desc, link_id asc") So it sorts the links by amount payed (highest first) and then by the order recieved (link_id) oldest first I was missing (apparently) the asc desc syntax and a comma between (at least it works with the comma so I assume that was required as well). Thanks Lisa