[thelist] PHP & Crosstabs [long] MORE CLEARLY MAYBE...

Jay Blanchard jay.blanchard at niicommunications.com
Tue May 7 14:40:12 CDT 2002


[snip]
> If I knew the number of columns (and their names)

those are in the result set from your first query --

  SELECT DISTINCT RecordID
         FROM tblCrosstab
     ORDER BY RecordID

loop through those creating a TH for each name (RecordID)

why do you want to know the number?
[/snip]

When you want to write out a table row you have to know where the data is
coming from;
<?
while($dbrow = mysql_fetch_object($dbx)){
	print("<tr>\n");
	print("<td>");
	print($dbrow->RecordDate);
	print("</td><td align=\"right\">");
	print($dbrow->r100101); <--------------uses the "AS" from the query
	print("</td><td align=\"right\">");
	print($dbrow->r100118);
	print("</td><td align=\"right\">");
	print($dbrow->r100119);
	print("</td><td align=\"right\">");
 	print($dbrow->r100120);
	print("</td>\n");
	print("</tr>\n");
	}
?>

Since I don't know what those will be I am having a problem, but I think I
may be able to do a nested while statement using the first query results
with a little mucking around and get it.

Thanks!

Jay





More information about the thelist mailing list