I'm not sure if this is possible...but I love the jquery tablesorter- but I can't figure out how to get it working. My page displays as if it's not even there. I used php to snmpget some data from my network switches and routers. It saves it to my DB...then I have this page to display the information from the database. This is where I want to be able to sort, by switch type, software version, etc. I'm not a code guy, just a network engineer trying to make my job easier. Your help please is MUCHHHHHHHHH appreciated. I've been trying to get this to work off and on for 6 months.
This is what I've got so far.... The page looks something like this when I load it. Host Name Device Type Firmware Version Software Version edge-109c-gs.gov.ntwk 470-24T "3.6.0.7" "v3.7.3.13" edge-241c-gs.anx.ntwk 470-24T "3.6.0.7" "v3.7.3.13" edge-399c-gs.anx.ntwk 470-24T "3.6.0.7" "v3.7.3.13" <html> <body> <?php $username="root"; $password=""; $database="switchesdb"; mysql_connect(localhost,$username,$password); mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM switchcode"; $result=mysql_query($query); $num=mysql_numrows($result); ?> <head> <script type="text/javascript" src="/var/www/html/jquery-1.3.2.js"></ script> <script type="text/javascript" src="/var/www/html/ jquery.tablesorter.min.js"></script> <script type="text/javascript" $(document).ready(function() { // call the tablesorter plugin $("table").tablesorter({ // enable debug mode debug: true }); });</script> <table id="table"> <table class="tablesorter" cellspacing="1"> <thead> <table border="1" cellspacing="4" cellpadding="4"> <tr> <th><font face="Arial, Helvetica, sans-serif">Host Name</font></th> <th><font face="Arial, Helvetica, sans-serif">Device Type</font></th> <th><font face="Arial, Helvetica, sans-serif">Firmware Version</font></ th> <th><font face="Arial, Helvetica, sans-serif">Software Version</font></ th> </tr> </thead> </head> <?php $i=0; while ($i < $num) { $host_name=mysql_result($result,$i,"host_name"); $device_type=mysql_result($result,$i,"device_type"); $firmware_version=mysql_result($result,$i,"firmware_version"); $software_version=mysql_result($result,$i,"software_version"); ?> <tbody> <tr> <td><font face="Arial, Helvetica, sans-serif"><?php echo $host_name; ? ></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $device_type; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php $cleanstring =strstr($firmware_version, "\""); echo ($cleanstring); ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php $cleanstring1 =strstr($software_version, "\""); echo ($cleanstring1); ?></font></td> </tr> </tbody> </body> </html> <?php $i++; } ?>