View Full Version : problem Sorting a table by two criteria using CS4

03-16-2010, 06:45 AM
I am using CS4 to try to sort a DB which i am pulling onto a web page. I get the error message:
"The Sort Table command cannot be applied to this table. Check that each TR tag contains only TD or TH tags. Also check that if the table contains THEAD, TFOOT and/or TBODY tags, there are no TR tags otuside of those sections."
I don't think I have any THEAD, TFOOT or TBODY tages and it appears to me all TR tags only contain TD or TH tags.
Please let me know what I am not seeing in this so i can use CS4 to make it sort. I am trying to sort by the "date" column first then the "time" column.
Thanks ahead of time for your help.

<?php require_once('../Connections/dodvitals.php'); ?>
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
return $theValue;

mysql_select_db($database_dodvitals, $dodvitals);
$query_Recordset1 = "SELECT * FROM tonyberish";
$Recordset1 = mysql_query($query_Recordset1, $dodvitals) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<h1 align="center">Tony Berish - Vital Metrics</h1>
<table border="1">
<td>Entry Time</td>
<?php do { ?>
<td><?php echo $row_Recordset1['PrimaryKey']; ?></td>
<td><?php echo $row_Recordset1['date']; ?></td>
<td><?php echo $row_Recordset1['time']; ?></td>
<td><?php echo $row_Recordset1['HR']; ?></td>
<td><?php echo $row_Recordset1['BP']; ?></td>
<td><?php echo $row_Recordset1['SpO2']; ?></td>
<td><?php echo $row_Recordset1['Temp']; ?></td>
<td><?php echo $row_Recordset1['BloodGlucose']; ?></td>
<td><?php echo $row_Recordset1['Medication']; ?></td>
<td><?php echo $row_Recordset1['Dosage']; ?></td>
<td><?php echo $row_Recordset1['LOC']; ?></td>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>

03-16-2010, 09:24 AM
Do you have any HTML in any of that data you are pulling into the table to display? That might be what's causing the complaint.

03-16-2010, 03:53 PM
No HTML in the data. It is text, date, time and int only.