[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

TableSorter Problem

Posted on 2011-03-03
7
Medium Priority
?
799 Views
Last Modified: 2012-05-11
I'm trying to use the TableSorter and the TableSorterPagination function.  I tested the example (tablesorter.html) and it works fine (table sorter and pagination).  Now, when i edit the example to what I'm trying to create, none of the sort and pagination function works on my "tablesorter.php" file, once I included my php code.  ANY HELP Please....see 2 files below...

Tablesorter.html:

<html>
<head>
<title> Jquery Plugin: TableSorter</title>
<link rel="stylesheet" href="css/tsorter_style.css" type="text/css" />
<script type="text/javascript" src="js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="js/jquery.tablesorter.js"></script>
<script type="text/javascript" src="js/jquery.tablesorter.pager.js"></script>
</head>
<!-- I will only list some data to give idea of what's going on -->
<body>
<table id="insured_list" class="tablesorter">
<thead>
<tr>
<th>Last Name</th>
<th>First Name</th>
<th>Email</th>
<th>Age</th>
<th>Premium Amount</th>
</tr>
</thead>
<tbody>
<tr>
<td>mendes</td>
<td>Domnic</td>
<td>domnic@gmail.com</td>
<td>29</td>
<td>5500</td>
</tr>
---- remaining rows ---
</tbody>
</table>
<div id="page" class="pager">
<form>
<img src="images/first.png" class="first"/>
<img src="images/prev.png" class="prev" />
<input type="text" class="pagedisplay" />
<img src="images/next.png" class="next"/>
<img src="images/last.png" class="last"/>
<select class="pagesize">
<option value="">LIMIT</option>
<option value="2">2 per page</option>
<option value="5">5 per page</option>
<option values="10">10 per page</option>
</select>
</form>
</div>
<script defer="defer">
$(document).ready(function()
{
$("#insured_list")
.tablesorter({widthFixed: true, widgets: ['zebra']})
.tablesorterPager({container: $("#pager")});
}
};
</script>
</body>
</html>

Tablesorter.php

<html>
<head>
<title> Jquery Plugin: TableSorter</title>
<link rel="stylesheet" href="css/tsorter_style.css" type="text/css" />
<script type="text/javascript" src="js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="js/jquery.tablesorter.js"></script>
<script type="text/javascript" src="js/jquery.tablesorter.pager.js"></script>
</head>
<!-- I will only list some data to give idea of what's going on -->
<body>

<?php

include("db_connect.php");

$query="SELECT * FROM usr_accts ORDER by lname";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

echo "<b><center>User Accts Information</center></b><br>";
?>

<table id="insured_list" class="tablesorter">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
</tr>
</thead>

<?
$i=0;

while($i < $num) {

$id=mysql_result($result, $i, "id");
$fname=mysql_result($result, $i, "fname");
$lname=mysql_result($result, $i, "lname");
---- remaining fields ---

?>

<tbody>
<tr>

<td><? echo $fname; ?></td>
<td><? echo $lname; ?></td>
--- remaining rows ---
</tr>

<?
$i++
?>

</tbody>
</table>

<div id="page" class="pager">
<form>
<img src="images/first.png" class="first"/>
<img src="images/prev.png" class="prev" />
<input type="text" class="pagedisplay" />
<img src="images/next.png" class="next"/>
<img src="images/last.png" class="last"/>
<select class="pagesize">
<option value="">LIMIT</option>
<option value="2">2 per page</option>
<option value="5">5 per page</option>
<option values="10">10 per page</option>
</select>
</form>
</div>

<script defer="defer">
$(document).ready(function()
{
$("#insured_list")
.tablesorter({widthFixed: true, widgets: ['zebra']})
.tablesorterPager({container: $("#pager")});
}
};
</script>
</body>
</html>

0
Comment
Question by:melvint91
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 13

Expert Comment

by:darren-w-
ID: 35027581
I think your missing some closing curly brackets around here:

</tr>

<?
$i++
?>

</tbody>
</table>

Open in new window

0
 
LVL 3

Expert Comment

by:pius_babbun
ID: 35027624
Could you please explain what exactly the problem is ? And it would not consume time for us to figure and fix it ?
0
 

Author Comment

by:melvint91
ID: 35027884
darren-w:  I forgot to include the curly brackets when I typed it in above.

pius babbun:  basically, you should be able to click any table header and it sorts "asc".  Also, you should be able to select how many rows per page you want to display.  Everything works correctly in the tablesorter.html page (example I downloaded).  Once I modified "tablesorter.html" and included PHP coding (tablesorter.php), none of the functions work, for example sorting table by selecting any header and when I select a page number at bottom of table to display specific row amount per page--doesn't work anymore..
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 13

Expert Comment

by:darren-w-
ID: 35027949
Can you show the source the php outputs, I think it may be to do with the table code not being well formed
0
 

Author Comment

by:melvint91
ID: 35028324
darren-w: Are you asking to see the source code? if yes, it's within the code I sent... If you asking to see the output, I can't display it because it's on our Secured server.
0
 

Accepted Solution

by:
melvint91 earned 0 total points
ID: 35071077
I decided to go with something a little different
0
 

Author Closing Comment

by:melvint91
ID: 35120639
Wasn't exactly what i wanted to do but it was a substitute missing only one feature.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question