Jump to content

Recommended Posts

I apoligize if this is'nt in the appropriate spot but I wasnt sure where to put.  I am using mostly php with html, javascript.  i  have a table that can be sorted dynamically on a web site that works everywhere but firefox. The problem is the links in the table headers wont show up so they can be clicked on to sort the colunm. I dont think its the actual javascript file because as soon as I take out the string with the table data that is being populated from the databsase and use the example table data it works.

 

I have been trying to debug this for two days and now I need some advice from the best:). any help is appreciatted

 

for example, I am able to sort the records when I use this..

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
	<title>Table Sorter Proof of Concept</title>

	<link rel="stylesheet" href="style.css" type="text/css" />

	<script type='text/javascript' src='common.js'></script>
	<script type='text/javascript' src='css.js'></script>
	<script type='text/javascript' src='standardista-table-sorting.js'></script>
</head>
<?php
//connect to database
include'db.php';

//get all data from table
$sql = "SELECT * from products";
$result = @mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));

    $display_block = "<p align = 'center'> <table class='sortable' border = '1' bordercolor = 'black' cellpadding= '0' cellspacing = '0'>
<thead>
			<tr>
				<td></td>
				<th colspan='2'>Name</th>
				<td></td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<th>Date</th>
				<th>Forename</th>
				<th>Surname</th>
				<th>Number</th>
				<th>Price</th>
				<th>IP Address</th>
				<th>Scientific</th>
			</tr>
		</thead>
		<tfoot>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<th class='numeric'>385</th>
				<th class='numeric'>$160.91</th>
				<td></td>
				<td></td>
			</tr>
		</tfoot>
		<tbody>
			<tr>
				<td>21/01/2006</td>
				<td>Neil</td>
				<td>Crosby</td>
				<td class='numeric'>123</td>
				<td class='numeric'>$1.96</td>
				<td>192.168.1.1</td>
				<td>-12E2</td>
			</tr>
			<tr class='odd'>
				<td>01/02/2006</td>
				<td>Becca</td>
				<td>Courtley</td>
				<td class='numeric'>122</td>
				<td class='numeric'>$23.95</td>
				<td>192.167.2.1</td>
				<td>12E2</td>
			</tr>
			<tr>
				<td>17/11/2004</td>
				<td>David</td>
				<td>Freidman</td>
				<td class='numeric'>048</td>
				<td class='numeric'>$14.00</td>
				<td>192.168.2.1</td>
				<td>13e-2</td>
			</tr>
			<tr class='odd'>
				<td>17/10/2004</td>
				<td>Sylvia</td>
				<td>Tyler</td>
				<td class='numeric'>43</td>
				<td class='numeric'>$104.00</td>
				<td>192.168.2.17</td>
				<td>12.1e2</td>
			</tr>
			<tr>
				<td>17/11/2005</td>
				<td>Carl</td>
				<td>Conway</td>
				<td class='numeric'>49</td>
				<td class='numeric'>$17.00</td>
				<td>192.168.02.13</td>
				<td>12e3</td>
			</tr>
		</tbody>
	</table>";
?>
</html>
<?php echo($display_block);?> 

 

But it doesnt work with this........ ???

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><head>
<title>Product Inventory</title>

	<script type='text/javascript' src='common.js'></script>
	<script type='text/javascript' src='css.js'></script>
	<script type='text/javascript' src='standardista-table-sorting.js'></script>        <style type="text/css">
<!--
.style5 {font-family: "Times New Roman", Times, serif;
font-size: 14px;
}
-->
        </style>
        </head>
	<LINK href="demo.css" type=text/css rel=stylesheet>

<?php
//connect to database
include'db.php';

//checks if category is selected or submitted
if  (!isset($_POST['submit'])||(($_POST['select']) == 'All categories')){

//get all data from table
$sql = "SELECT * from products";
$result = @mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));

}else{

//get selected data of records
$get_list_sql = "SELECT * FROM products WHERE Category = '".$_POST['select']."'";
$result = mysqli_query($mysqli, $get_list_sql) or die(mysqli_error($mysqli));
}	
    $display_block = "<p align = 'center'> <table class='sortable' border = '1' bordercolor = 'black' cellpadding= '0' cellspacing = '0'>
<thead align='center'>
<th   bgcolor = 'orange'>Item Number</th>
<th   bgcolor = 'orange'>Manufacturer</th>
<th   bgcolor = 'orange'>Category</th>
<th   bgcolor = 'orange'>Description</th>
<th   bgcolor = 'orange'>Model</th>
<th   bgcolor = 'orange'>Quantity</th>
<th   bgcolor = 'orange'>Kw</th>
<th   bgcolor = 'orange'>Hours</th>
<th   bgcolor = 'orange'>Price</th> 
</thead>
<tbody>";

//if authorized, get the values
while ($info = mysqli_fetch_array($result)) {

//create display string
$display_block .= "
<tr>
<td>".$info['Item_No']."</td>
<td>".$info['Manufacturer']."</td>
<td>".$info['Category']."</td>
<td>".$info['Description']."</td>
<td>".$info['Model']."</td>
<td>".$info['Qty']."</td>
<td>".$info['Kw']."</td>
<td>".$info['Hours']."</td>
<td>".$info['Price']."</td>
</tr>";
}
$display_block .= "</tbody></table></p>"; 
?>

<style type="text/css">
<!--
body {
background-color: #333333;
background-image: url(images/bg_tile.gif);
}
.style8 {font-size: 12px}
.style10 {font-family: "Times New Roman", Times, serif; font-size: 14px; font-weight: bold; }
a:visited {
color: #000000;
text-decoration: none;
}
a:hover {
color: #FF6600;
background-color: #999999;
text-decoration: underline;
}
a:link {
color: #000000;
text-decoration: none;
}
a:active {
color: #FF6600;
text-decoration: none;
}
.style12 {font-size: 14px}
.style13 {font-family: "Times New Roman", Times, serif; font-size: 18px; }
.style14 {color: #FF0000}
</style>
<div align="center">
  <table width="1035" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <th height="42" align="left" valign="middle" scope="col"><div align="center">
        <p><img src="images/reagman_L.gif" alt="Reagan logo" width="99" height="98" /><img name="ReaganPower" src="images/Reagan Power.gif" width="581" height="59" border="0" id="ReaganPower" alt="Reagan logo" /><img src="images/reagman_R.gif" alt="Reagan logo" width="99" height="98" /></p>
      </div>
      <div align="center"></div></th>
    </tr>
    <tr>
      <th height="23" align="left" valign="middle" bordercolor="#797268" bgcolor="#EDA350" scope="col"> </th>
    </tr>
    
    <tr>
      <td width="881" align="left" valign="top" bordercolor="#797268" bgcolor="#FFFFFF"><p>Products>Product Inventory: <br />
          <br />
          Click on column heading to sort.<br />
      <a href="product_inventory.php5"></a></p>
        <form id="form1" name="form1" method="post" action="">
          <label>
          <div align="right">Display by Category:
            <select name="select" class="input">
		  <option>All categories</option>	
		  <option>Diesal</option>
              <option>Engines</option>
              <option>Generators</option>
            </select>
            <input name="submit" type="submit" id="submit" value="enter" />
          </div>
          </label>
        </form>
        <p><?php echo "$display_block"; 

//free results
mysqli_free_result($result);
?></p>
      <p> </p></td>
    </tr>
    
    <tr>
      <td height="24" bgcolor="#EDA350"><div align="center">
        <div id="Layer1"><span class="style5"><a href="index.html">home</a> | <a href="Products.html">products</a> | <a href="Parts_&_Service.html">parts & service</a> | <a href="Fabrication.html">fabrication</a> | <a href="Engineering.html">engineering</a> | <a href="http://www.reaganpowermarine.com/">marine division</a> | <a href="More_Information.html">more information</a></span></div>
        </div></td>
    </tr>
    <tr>
      <td background="images/BG11.jpg" bgcolor="#CCCCCC"><div align="center"><span class="style8"><strong>Reagan Equipment Co., Inc.</strong><br />
        Toll free: 800.264.7767<br />
      Email: <a href="mailto:info@reaganpower.com">info@reaganpower.com</a></span></div></td>
    </tr>
    <tr>
      <td background="images/BG1.png" bgcolor="#CCCCCC"><div align="center">
        <p class="style8">Copyright © 2007<br />
          <a href="http://www.point2pointhosting.com/" class="style12"> Hosted by point2point</a></p>
      </div></td>
    </tr>
  </table>
</div>
</body>
</html>

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.