php - jQuery tablesorter don't work -


the table diplayed normal can not sort it. both .js files in same directory .php file itself.

<html> <head> <script src="jquery-1.6.2.js" type="text/javascript"></script> <script src="jquery.tablesorter.js" type="text/javascript"></script> <script type="text/javascript">     $(document).ready(function() {     $("#tabel").tablesorter();     }); </script> </head> <body>  <?php  $con = pg_connect("user=bct password=bct host=localhost port=5432 dbname=users ") or die (pg_last_error()); $query = "select * users"; $result = pg_query($con, $query);   $t = '<table id="tabel" class="tablesorter">';  $t .= '<thead>'; //next code column names for($i=0; $i < pg_num_fields($result); $i++){     $field_info = pg_field_name($result, $i);     $t .= '<th>' . $field_info .  '</th>'; } $t .= '</thead>';   //next code fetch cell content $t .= '<tbody>';  while ($row=pg_fetch_row($result)){     $t .= '<tr>';     foreach($row $_column){     $t .= '<td>' .$_column. '</td>';     $temp=$row;     }     $t .= '</tr>'; }  $t .= '</tbody></table>';  echo $t;  pg_close($con); ?> </body> </html> 

give shot:

$t .= '<thead><tr>'; //next code column names for($i=0; $i < pg_num_fields($result); $i++){     $field_info = pg_field_name($result, $i);     $t .= '<th>' . $field_info .  '</th>'; } $t .= '</tr></thead>'; 

i wrapped <th>'s in <tr>, going off of example code here: http://tablesorter.com/docs/


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -