ciao funziona tieni la sto cercando di adattare al lavoro che devo fare ti posto la classe corretta e la provi
Codice PHP:
error_reporting(E_ALL);

class 
phpSortTable
{
    var 
$tableName;
    var 
$urlKeyName;
    var 
$tableKeyName;
    var 
$editLink "" ;
    var 
$editTarget;
    var 
$editWindowFormat;
    var 
$deleteLink "" ;
    var 
$addLink;
    var 
$addTarget;
    var 
$addText;
    var 
$editPromptMsg;
    var 
$deletePromptMsg;
    var 
$asc_img;
    var 
$desc_img;
    var 
$edit_img;
    var 
$delete_img;
    var 
$add_img;
    var 
$cellpadding "" ;
    var 
$cellspacing "" ;
    var 
$tableborder "" ;
    var 
$width "" ;
    var 
$tbclass "" ;
    var 
$style "" ;
    var 
$columHeader = array();
    var 
$columContent = array();
    var 
$tableTitle "" ;
    var 
$defaultRowsNum;
    var 
$imgFilePath;
    var 
$cssFilePath;
    var 
$emptyMsg;
    var 
$columns;
    var 
$selfLink;
    var 
$urlVars;  
    var 
$totalRows;
    var 
$shownRows;
    var 
$colsNum;
    var 
$rows;
    var 
$offset;
    var 
$sortby;
    var 
$name "" ;
    var 
$title "" ;
    
     function 
__construct($connectionData$tableName) {
        
$this->connectionData $connectionData;
        
$this->tableName $tableName;
        
$this->imgFilePath "phpSortTable/img/";
        
$this->cssFilePath "phpSortTable/php_sort_table.css";
        
$this->asc_img "asc.gif";
        
$this->desc_img "desc.gif";
        
$this->add_img "add.gif";
        
$this->delete_img "delete.gif";
        
$this->edit_img "edit.gif";
        
$this->defaultRowsNum 5;
        
$this->emptyMsg "No data to be shown.";
        
$this->editWindowFormat "";
    }
    
      function 
phpSortTable($connectionData$tableName) {
        
$this->connectionData $connectionData;
        
$this->tableName $tableName;
        
$this->imgFilePath "phpSortTable/img/";
        
$this->cssFilePath "phpSortTable/php_sort_table.css";
        
$this->asc_img "asc.gif";
        
$this->desc_img "desc.gif";
        
$this->add_img "add.gif";
        
$this->delete_img "delete.gif";
        
$this->edit_img "edit.gif";
        
$this->defaultRowsNum 5;
        
$this->emptyMsg "No data to be shown.";
    }

     function 
setPackageFilePath ($path) {
        
$this->packageFilePath $path;
    }
    
     function 
connect(){
        
$connParam explode(","$this->connectionData4);
        
$host $connParam[0];
        
$db $connParam[1];
        
$user $connParam[2];
        
$pass $connParam[3];
        
$connection mysql_connect($host$user$pass) or die(mysql_error());
        
mysql_select_db($db$connection) or die(mysql_error());
        return 
$connection;
    }

     function 
setTableFormat($cellpadding ""$cellspacing ""$tableborder ""$width ""$tbclass ""$style "") {
        
        
$this->cellpadding $cellpadding;
        
$this->cellspacing $cellspacing;
        
$this->tableborder $tableborder;
        
$this->width       $width;
        
$this->tbclass     $tbclass;
        
$this->style       $style;
    }    
    
     function 
printTable()
     {

        if (!empty(
$_REQUEST["offset"]) && is_numeric($_REQUEST["offset"]))
        {
            
$this->offset $_REQUEST["offset"];
        } else {
            
$this->offset "0";
        }
        
$this->sortby  = isset($_REQUEST['sortby'])?$_REQUEST['sortby']:'';
        
$this->sortdir = isset($_REQUEST['sortdir'])?$_REQUEST['sortdir']:'';        $this->rows    = isset($_REQUEST['rows'])?$_REQUEST['rows']:'';             if (substr($_SERVER['SCRIPT_NAME'] , -4) == '.php'){
        
$this->selfLink $_SERVER['SCRIPT_NAME'] . '?';
        }else{
        
$this->selfLink $_SERVER['SCRIPT_NAME'] . '&';
        }    
        if (
substr($this->urlVars , -4) == '.php'){
        
$this->urlVars "" '?';
        }else{
        
$this->urlVars "" '&';
        }
        foreach (
$_GET as $key => $value) {
        if((
$key != "sortby") && ($key != "rows") && ($key != "offset") && ($key != "sortdir")) {
            
                
$this->selfLink .=  $key '=' $value;
                
$this->urlVars  .=  $key '=' $value;
            }
        }
        if (
strlen($this->sortdir) < 1){$this->sortdir "ASC";}
        if (
strlen($this->rows) < 1){
            
$this->rows $this->defaultRowsNum;

        }
        
$connection $this->connect();
        
$sql "SELECT * FROM " $this->tableName;
        
/*         #appends the WHERE clause if it exists
 *        if (strlen($this->whereClause) > 0)
 *            $sql .= $this->whereClause;
 */        
        
if (strlen($this->sortby) > 0)
            
$sql .= " ORDER BY " $this->sortby " " $this->sortdir;
            
$sql .= " LIMIT " $this->offset ", " $this->rows;
   
/*  $sqlT = "SELECT * FROM " . $this->tableName;
    *     #appends the WHERE clause if it exists
    *    if (strlen($this->whereClause) > 0)
    *        $sqlT .= $this->whereClause;
    */
        
$select mysql_query($sql$connection) or die(mysql_error());
        
$this->sortdir = ($this->sortdir == "ASC") ? "ASC" "DESC";
        
$this->sortimg = ($this->sortdir == "ASC") ? $this->asc_img $this->desc_img;
        
$this->totalRows mysql_num_rows($select);
        
$this->shownRows mysql_num_rows($select);
        
$this->colsNum count($this->columns);
        echo 
'<link href="'.$this->cssFilePath.'" rel="stylesheet" type="text/css">';    
        
# if table is empty, shows the Empty Message
        
if ($this->totalRows 1) {
            
$this->printEmptyMsg();
        }else{
            
$this->printHeader();
            
$this->printContent($select);
        }
        
$this->printFooter();
        
mysql_close($connection);
    }
     function 
printHeader()
     {    
      echo 
'<table cellpadding="'.$this->cellpadding.'" cellspacing="'.$this->cellspacing.'" border="'.$this->tableborder.'" width="'.$this->width .'" class="'.$this->tbclass.'" style="'.$this->style.'">';
      if(
count($this->columHeader) > 0) {
        echo 
"<thead>";
          echo 
"<tr>";
            for(
$ii=0$ii<count($this->columHeader); $ii++){
             echo 
'<td id =  "tab'.$this->columHeader[$ii].'"';
                if(!empty(
$this->columHeader[$ii]['class']))    echo 'class   = "'.$this->columHeader[$ii]['class'].'"'
                if(!empty(
$this->columHeader[$ii]['width']))    echo 'width   = "'.$this->columHeader[$ii]['width'].'"';
                if(!empty(
$this->columHeader[$ii]['height']))   echo 'height  = "'.$this->columHeader[$ii]['height'].'"'
                if(!empty(
$this->columHeader[$ii]['colspan']))  echo 'colspan = "'.$this->columHeader[$ii]['colspan'].'"';
                if(!empty(
$this->columHeader[$ii]['align']))    echo 'align   = "'.$this->columHeader[$ii]['align'].'"';  
                if(!empty(
$this->columHeader[$ii]['valign']))   echo 'valign  = "'.$this->columHeader[$ii]['valign'].'"';  
             echo 
'nowrap="nowrap">';
         echo 
$this->columHeader[$ii]['title'] ;
        echo  
'</td>';
        }
        echo 
"</tr>";
      echo 
"</thead>";
      }
        if(
substr($_SERVER['SCRIPT_NAME'] , -4) == '.php'){
        
$this->selfLink $_SERVER['SCRIPT_NAME'] . '?';
        }else{
        
$this->selfLink $_SERVER['SCRIPT_NAME'] . '&';
        }
        
$index=0;
        echo 
'<tr id="headerRow">';
        foreach(
$this->columns as $column){    
            
$sortLink $this->selfLink 'rows=' .$this->rows.'&offset='.$this->offset;
            
$sortLink .= '&sortby='.$column->name;
            
$sortLink .= ($this->sortdir == 'ASC') ? '&sortdir=DESC' '&sortdir=ASC';    
            echo 
'<td id="headerCell"'
                if(!empty(
$this->columContent[$index]['class']))    echo 'class   = "'.$this->columContent[$index]['class'].'"';   
                if(!empty(
$this->columContent[$index]['width']))    echo 'width   = "'.$this->columContent[$index]['width'].'"';  
                if(!empty(
$this->columContent[$index]['height']))   echo 'height  = "'.$this->columContent[$index]['height'].'"';  
                if(!empty(
$this->columContent[$index]['colspan']))  echo 'colspan = "'.$this->columContent[$index]['colspan'].'"'
                if(!empty(
$this->columContent[$index]['align']))    echo 'align   = "'.$this->columContent[$index]['align'].'"';  
                if(!empty(
$this->columContent[$index]['valign']))   echo 'valign  = "'.$this->columContent[$index]['valign'].'"';  
             echo 
'nowrap="nowrap">';                
                echo 
'[url='$sortLink ']'.$column->title .'[/url]';
            if(
$this->sortby == $column->name)
        echo 
'[img]'.$this->imgFilePath $this->sortimg .'[/img]';
                echo 
'</td>';
        }
        if (
strlen($this->editLink) > 0)
            echo 
"<td></td>";
        if (
strlen($this->deleteLink) > 0)
            echo 
"<td></td>";
        echo 
"</tr>";
        
$index++;
    }
    
     function 
printContent($query){
        
$count 0;    
        while(
$row mysql_fetch_array($query)){
            
$style = ($count == 0) ? "contentRow1" "contentRow2";
            echo 
'<tr id="'$style .'" >';
            foreach (
$this->columns as $key => $column) {
                echo 
'<td id="contentCell">';
                    echo  
htmlspecialchars($row[$column->name]);
                echo 
'</td>';
            }
            
$key $this->urlKeyName;
            
$keyVal $row[$this->tableKeyName];
            if (
strlen($this->editLink) > 0){
                if (
substr($this->editLink , -4) == '.php'){
                   
$eLink $this->editLink "?" $this->urlKeyName "=" $row[$this->tableKeyName] . $this->urlVars;
                } else {
                   
$eLink $this->editLink "&" $this->urlKeyName "=" $row[$this->tableKeyName] . $this->urlVars;
                }
                echo 
'<td width="2%" alt="edit" title="edit">';
                echo 
'<a href='.$eLink.'>';
                
                echo 
'[img]'.$this->imgFilePath .$this->edit_img '[/img]';
                echo 
"</a>";
                echo 
"</td>";
            }
            if (
strlen($this->deleteLink) > 0){
                if (
substr($this->deleteLink , -4) == '.php'){
                   
$dLink $this->deleteLink '?' $this->urlKeyName '=' $row[$this->tableKeyName] . $this->urlVars;
                } else {
                   
$dLink $this->deleteLink '&' $this->urlKeyName '=' $row[$this->tableKeyName] . $this->urlVars;
                }
                echo 
'<td width="2%" alt="delete" title="delete">';
                echo 
'<a href='.$dLink.' >';
                echo 
'[img]'.$this->imgFilePath.$this->delete_img.'[/img]';
                echo 
'</a>';
                echo 
'</td>';
            }
            echo 
'</tr>';
            
$count++;
        }
        echo 
'<table>';
    }
     function 
printFooter() {

     }
     function 
printEmptyMsg() {
        echo 
'<table id="contentTable" "'.$this->formatString.'">';
        echo 
'<tr id="contentRow1"><td></td></tr>';
        echo 
'<tr id="contentRow1">';
        echo 
'<td id="emptyMsg">"'.$this->emptyMsg'"</td>';
        echo 
'</tr>';
        echo 
'<tr id="contentRow1"><td></td></tr>';
        echo 
'</table>';
    }

}
class 
displayGrid {

    var 
$name;
    var 
$title;
    function 
__construct ($name$title) {
        
$this->name $name;
        
$this->title $title;
    }

la inserisci nei tuoi lavori cosi
Codice PHP:
    require "../php_sort_table.php";
    
$yourHost     "localhost";
    
$yourDB     "guru";
    
$yourUser     "root";
    
$yourPass    "maurizio";
    
$yourTable    "tblusers";
    
$dbConnString $yourHost "," $yourDB "," $yourUser "," $yourPass;
    
$sortable = new phpSortTable($dbConnString$yourTable);    
    
$col_0 = new displayGrid("UserId""ID");
             
$col_1 = new displayGrid("Name""Name");
    
$col_2 = new displayGrid("Email""Email");
             
$col_3 = new displayGrid("DOB""DOB");
             
$col_4 = new displayGrid("ru_fp""ru_fp");
     
$sortable->columns = array(0=>$col_01=>$col_12=>$col_23=>$col_34=>$col_4, ); 
    
    
$sortable->setTableFormat ("2""2""0" ,"100%"); 
    
$sortable->editLink "example_01.php?delete=user";
    
$sortable->deleteLink "example_01.php";
    
$sortable->addLink "addlink.php";
    
$sortable->addText "add a new entry";
    
$sortable->urlKeyName "UserId";
    
$sortable->tableKeyName "UserId";
    
$sortable->columHeader[0]['width'] = "100";
    
$sortable->columHeader[0]['title'] = "prova";
    
$sortable->columHeader[1]['width'] = "100";
    
$sortable->columHeader[1]['title'] = "xxxxxxxxxx";
    
/* $sortable->editTarget = "_blank"; */
    #define the deafult row number to be displayed
    
$sortable->defaultRowsNum "10";
    
#define the path for the css file
    
$sortable->cssFilePath "../php_sort_table.css";    
    
#define the path for of the images directory
    
$sortable->imgFilePath "../img/";
    
$sortable->printTable(); 
ti posto il database
codice:
CREATE TABLE `tblusers` (
  `UserId` int(11) NOT NULL auto_increment,
  `Name` varchar(50) NOT NULL default '',
  `Email` varchar(255) NOT NULL default '',
  `DOB` text NOT NULL,
  `ru_fp` bigint(11) NOT NULL,
  PRIMARY KEY  (`UserId`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8 AUTO_INCREMENT=25 ;
INSERT INTO `tblusers` VALUES (9, 'Neeraj', 'neeraj@yahool.com', '1980-04-04', 0);
INSERT INTO `tblusers` VALUES (10, 'tqtet', 'tqewtewqt', '1980-04-04', 0);
INSERT INTO `tblusers` VALUES (11, 'uffa', 'fsafasf', '1979-05-01', 0);
INSERT INTO `tblusers` VALUES (13, 'cazzo', 'figa', '1980-04-04', 0);
INSERT INTO `tblusers` VALUES (14, 'yyyffff', 'fffffff@bfbf.com', '1979-01-01', 0);
INSERT INTO `tblusers` VALUES (15, '1980-04-04', '1980-04-04', '1980-04-04', 0);
INSERT INTO `tblusers` VALUES (19, 'ewqet', 'weqtewqt', '0', 1);
INSERT INTO `tblusers` VALUES (20, 'weqtewqt', 'ewqt', '1', 1);
INSERT INTO `tblusers` VALUES (21, 'wqtet', 'etew', 'twqt', 1);
INSERT INTO `tblusers` VALUES (22, 'wqtewt', 'ewtewtwe', 'ttwqtqewt', 1);
INSERT INTO `tblusers` VALUES (23, 'wqetewtee', 'wetet', '1', 1);
INSERT INTO `tblusers` VALUES (24, '12341325', '3215325', '1', 1);