www.webdeveloper.com
Results 1 to 4 of 4

Thread: Sorting problem

  1. #1
    Join Date
    Feb 2010
    Posts
    3

    Sorting problem

    I have a table of registered users that contains basic information.
    I want to be able to sort by a-z and also have the ability to view a-e; f-j; k-o; p-t; u-z

    Code:
              <table id="myTable" width="100%" border="0" align="center" cellpadding="2" cellspacing="3">
                <thead>
                  <tr>
                    <th width="6%" class="tableheading" style="cursor:pointer;">S.No.</th>
                    <th width="28%" class="tableheading" style="cursor:pointer;">User Email ID</th>
                    <th width="12%" class="tableheading" style="cursor:pointer;">No. of Teams</th>
                    <th width="12%" class="tableheading" style="cursor:pointer;">City Name</th>
                    <th width="12%" class="tableheading" style="cursor:pointer;">Country</th>
                    <th width="14%" class="tableheading" style="cursor:pointer;">Status</th>
                    <th align="center" class="tableheading">Edit</th>
                    <th colspan="2" align="center" class="tableheading">Delete</th>
                  </tr>
                </thead>
                <tbody>
                  <?php 
                             
                            $i = 1;					
                            while($rowcat=mysql_fetch_array($rscat)) 
                            { 			
                                $uid = $rowcat['id'];
                                $query_team = "select count(userid) as count_team from user_teams where userid='$uid'";
                                $rs_team = mysql_query($query_team);
                                $row_team = mysql_fetch_array($rs_team);
                                $count_team = $row_team['count_team'];
                                
                                $status = $rowcat['Register'];
                                if($status = 'register')
                                {
                                    $user_status = 'Registered';
                                }
                                else
                                {
                                    $user_status = 'Not Registered';
                                }
                                    
                                
                        ?>
                  <tr class="alternate">
                    <td valign="top" class="alternate"><?php echo $i++; ?></td>
                    <td valign="top" class="alternate"><?php echo $rowcat['email']; ?></td>
                    <td valign="top" class="alternate"><?php echo $count_team; ?></td>
                    <td valign="top" class="alternate"><?php echo $rowcat['cityname']; ?></td>
                    <td valign="top" class="alternate"><?php echo $rowcat['country']; ?></td>
                    <td valign="top" class="alternate"><?php echo $user_status; ?></td>
                    <td valign="top" class="alternate"><div align="center"><a href="editUserInfo.php?id=<?php echo $rowcat['id']; ?>&amp;page=<?php echo $pageno; ?>&amp;a=<?php echo $a; ?>&amp;b=<?php echo $b; ?>"><img src="images/icon_edit.png" alt="Edit" width="20" height="20" /></a></div></td>
                    <td colspan="2" valign="top" class="alternate"><div align="center"><a href="deleteUserInfo.php?id=<?php echo $rowcat['id']; ?>&amp;page=<?php echo $pageno; ?>&amp;a=<?php echo $a; ?>&amp;b=<?php echo $b; ?>"><img src="images/icon_delete.png" alt="Edit" width="20" height="20" /></a></div></td>
                  </tr>
                  <? //$n++;
                        // }
                         
                         }
                         ?>
                </tbody>
              </table>
    what do i have to change or add in order to make this possible? any help will be great.. thanks

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    You can use AJAX, and a server-side code to sort data. In other words you should do that sorting with PHP, and use AJAX only to display on document the already sorted data.

  3. #3
    Join Date
    Feb 2010
    Posts
    3
    what code would i need to insert in order to sort with PHP?

  4. #4
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles