hi Does anyone here know how to make a table with html and make it so that people can sort the diferent colums of info, in php and SQL

Sure do,

What you need to do is the following:
1) Create a list of all of the attributes of your mysql table you would like to sort the table by.
2) Organize these into a switch statement at the top of your page in php, eg:

$sortby = intval($_GET['sort']);
switch ($sortby)
{
   case 1:
   {
          $sqlExtra = "ORDER BY name ASC";
    };break;
   case 2:
   {
          $sqlExtra = "ORDER BY name DESC";
    };break;
  //etc with the rest of the attributes
}

And then, after the switch statement append the $sqlExtra to your sql statement, eg:

$sql = "SELECT values FROM table ".$sqlExtra;

3) Now all you need is a bunch of links above or below or wherever relative to your table which must link back to this page but with a $_GET[] variable specified for 'sort', eg:

<a href="thispage.php?sort=1">Sort by name (A-Z)</a>
<a href="thispage.php?sort=2">Sort by name (Z-A)</a>

Good luck

Amost forgot, dont forget to initialize $sqlExtra to nothing above your switch statement and don't forget to include a default case.
Just ask if you need help again.

hi here is the attachment in javascript and to make html sortable just add class="sortable" to table u want sorting
and for td u don`t wanna sort just add class="sorttable_nosort"
and include this javascript file
since it is in javascript page will not get refreshed

try using jquery for sortable table and pagination and use some ajax commands so your users don't have to refresh the page every time the user the sort functions the jquery can call up a external php file with the sql access to make it easier for your users

I am trying to implement pagination to the rows in my table. Can the sorting still be done using javascript on the table with pages (using a .js file like posted here above for example)?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.