[thelist] PHP & Crosstabs [long] MORE CLEARLY MAYBE...SOLVED!!!
Jay Blanchard
jay.blanchard at niicommunications.com
Wed May 8 08:17:01 CDT 2002
[snip]
while($dbrow = mysql_fetch_object($dbx)){
print("<tr>");
print("<td>");
print($dbrow->RecordDate); <----------RecordDate in first column
print("</td>");
mysql_data_seek($dbrid, 0);
while($rowx = mysql_fetch_object($dbrid)){
print("<td>");
print($dbrow->RecordID); <--------data in each subsequent column
print("</td>");
}
print("</tr>\n");
}
[/snip]
Ah Andrew, thanks for providing the keys dear sir....clearing the fog from
my old head. Here is the solution;
<table border="1">
<tr bgcolor="#FFFFCC">
<td></td>
<?
mysql_data_seek($dbrid, 0);
while($rowx = mysql_fetch_object($dbrid)){
print("<td>");
print("$rowx->RecordID"); <----from the original query
print("</td>\n");
}
?>
</tr>
<?
while($dbrow = mysql_fetch_row($dbx)){ <-------row as array
print("<tr>");
$col_num = 0; <----column variable
foreach($dbrow as $key=>$value){
print("<td>$dbrow[$col_num]</td>\n"); <---each column
$col_num++;
}
print("</tr>\n");
}
?>
</table>
Maybe this can be written cleaner, but it sure works well.
Thanks!
Jay
More information about the thelist
mailing list