...

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



mikeberish
03-16-2010, 05: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'); ?>
<?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";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<h1 align="center">Tony Berish - Vital Metrics</h1>
<table border="1">
<tr>
<td>Entry Time</td>
<td>Date</td>
<td>Time</td>
<td>HR</td>
<td>BP</td>
<td>SpO2</td>
<td>Temp</td>
<td>BloodGlucose</td>
<td>Medication</td>
<td>Dosage</td>
<td>LOC</td>
</tr>
<?php do { ?>
<tr>
<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>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

Fumigator
03-16-2010, 08: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.

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

MB



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum