...

View Full Version : How to order by downloads/title my downloads script?



kaisellgren
06-09-2006, 11:57 AM
Hello,

My question is how do I make "Order by Downloads/Title/Date" for my download script? Help is really appreciated!

My script:

if (mysql_num_rows($result) > 0)
{
while ($row = mysql_fetch_assoc($result))
{
echo ('<tr>');
echo ('<td valign="top"><a href="screenshots/'.$row["screenshot"].'.jpg"><img src="screenshots/'.$row["screenshot"].'thumb.jpg" border="0" /></a></td>');
echo ('<td width="100%" valign="top"><div class="title">'.$row["title"].'</div>');
echo ('Author: '.$row["author"].'<br />');
echo ('Description: '.$row["description"].'<br />');
echo ('<br /><br />');
echo ('<a href="download.php?file='.$row["filename"].'.zip" class="menuitem">Download</a> ('.$row["downloads"].' Downloads)');
echo ('</td>');
echo ('</tr>');
}
}
else
echo ('No downloads.');

takin
06-09-2006, 12:28 PM
There are a number of ways to do this.
1 Create a Javascript array of the data and a script to clear and rewrite the table
2 Use links to rerun the page with an order by field in the query. Your page will need to keep track of the rest of the query by
2a saving data in a session
2b resubmitting data in a form (requires Javascript)

1 is probably the best option if you know a bit of Javascript and have a small result set.

degsy
06-09-2006, 04:08 PM
I would recommend option 2



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum