Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Location
    Finland, Hollola
    Posts
    285
    Thanks
    8
    Thanked 0 Times in 0 Posts

    How to order by downloads/title my downloads script?

    Hello,

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

    My script:
    PHP Code:
    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.'); 

  • #2
    New Coder
    Join Date
    May 2006
    Location
    Australia
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #3
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I would recommend option 2


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •