Sort not working for database entries. Help

This was exactly what I was looking for, but the actual sort function is not working for the database entries I'm placing in a table.

Here is the code:

        include('config.php');
$table_name =(ADMIN);
       
        $query="SELECT * FROM $table_name";
        $result=mysql_query($query);
        $num=mysql_numrows($result);
              
        
        
echo '<table cellpadding="0" cellspacing="0" border="0" id="table" class="sortable">';
        echo '<tr> <th >First Name</th> <th>Last Name</th> <th>Username</th> <th>Password</th> <th>Access Level</th> <th>Email</th> <th>Last Login</th></tr>';
        
$i=0;
while ($i < $num) {
                  echo "<tr>";
                echo '<td>' . mysql_result($result, $i, 'firstname') . '</td>';
                echo '<td>' . mysql_result($result, $i, 'lastname') . '</td>';
                echo '<td>' . mysql_result($result, $i, 'username') . '</td>';
                echo '<td>' . mysql_result($result, $i, 'password') . '</td>';
                echo '<td>' . mysql_result($result, $i, 'access_level') . '</td>';
                echo '<td>' . mysql_result($result, $i, 'email') . '</td>';
                echo '<td>' . mysql_result($result, $i, 'last_login') . '</td>';
                echo '<td ><a  class="class2"href="deleteadmin.php?username=' . mysql_result($result, $i, 'username') . '">Delete</a></td>';
                echo "</tr>";
                $i++;
}
                 echo "</table>";
                echo '<div id="controls">';
        echo '<div id="perpage">';
            echo '<select onchange="sorter.size(this.value)">';
            echo '<option value="5">5</option>';
                echo '<option value="10" selected="selected">10</option>';
                echo '<option value="20">20</option>';
                echo '<option value="50">50</option>';
                echo '<option value="100">100</option>';
            echo "</select>";
            echo "<span>Entries Per Page</span>";
        echo "</div>";
        echo '<div id="navigation">';
        echo     '<img src="images/first.gif" width="16" height="16" alt="First Page" onclick="sorter.move(-1,true)" />';
        echo     '<img src="images/previous.gif" width="16" height="16" alt="First Page" onclick="sorter.move(-1)" />';
        echo     '<img src="images/next.gif" width="16" height="16" alt="First Page" onclick="sorter.move(1)" />';
        echo     '<img src="images/last.gif" width="16" height="16" alt="Last Page" onclick="sorter.move(1,true)" />';
        echo "</div>";
        echo '<div id="text">Displaying Page <span id="currentpage"></span> of <span id="pagelimit"></span></div>';
    echo "</div>";

<nav menu>

</nav menu>

<script type="text/javascript" src="script.js"></script>
    <script type="text/javascript">
  var sorter = new TINY.table.sorter("sorter");
    sorter.head = "head";
    sorter.asc = "asc";
    sorter.desc = "desc";
    sorter.even = "evenrow";
    sorter.odd = "oddrow";
    sorter.evensel = "evenselected";
    sorter.oddsel = "oddselected";
    sorter.paginate = true;
    sorter.currentid = "currentpage";
    sorter.limitid = "pagelimit";
    sorter.init("table",1);
  </script>

 

Thanks for the help!
asked Dec 13, 2011 by anonymous

1 Answer

0 votes
Thanks for sharing this useful tool with me..!
answered Dec 25, 2011 by anonymous