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

Jay Blanchard jay.blanchard at niicommunications.com
Wed May 8 07:57:01 CDT 2002


[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

How about something like this:

// Only print out the <th> tags once....
[/snip]

Andrew,

That somes close, but it isn't doing what I need. Let's see if I can explain
more clearly.

First query gets RecordID's, second one gets crosstab. I can print out the
<th> using the first queries results. For each row after the I need to print
out the RecordDate and then each other column. It seems that I should be
able to do something like this

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");
	}


My brain hurts because this will not work like I expect.

Thanks!

Jay





More information about the thelist mailing list