Results 1 to 4 of 4

Thread: [solved] arranging sorted result

Threaded View

  1. #1

    Thread Starter
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552

    [solved] arranging sorted result

    i don't know if my subject meets my need here. hehe. i'm quiet new to this thing and done a 'hello world" so far. i wanted to sort a result by asc/desc when sort button is clicked. this is what i've got so far.
    PHP Code:
    <style>
    body,table,input{
       font:9pt arial;
    }
    td,th{
       padding:3px;
    }
    th{
       color:white;
    }
    </style>
    <?php
       mssql_connect
    ("x","sa","password");
       
    mssql_select_db("northwind");
       echo
    "<input type=submit value='sort'><br><br>";
       echo
    "<table cellspacing=1 bgcolor=#666699 width=100%>";
       echo
    "<tr><th>ID</th><th>Description</th><th>Region</th></tr>";
       
    load("select * from territories");
       echo
    "</table><br>";
       
       function 
    load($s){
          
    $result=mssql_query($s);
          
    $i=0;
          while(
    $row=mssql_fetch_array($result,MSSQL_NUM)){
             if(
    $i%2==0) echo"<tr bgcolor=white>";
             else echo
    "<tr bgcolor=#f4f4f4>";
             foreach(
    $row as $r) echo "<td>$r</td>";
             echo
    "</tr>";
             
    $i++;
          }
       }
    ?>
    i don't know how to have the page knowing wether it's asc/desc sort of the result. any help would be greatly appreciated.
    Last edited by brown monkey; Aug 4th, 2004 at 04:57 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width