|
Posted by Geoff Berrow on 05/30/07 15:50
Message-ID: <8tf7i.19983$j7.373786@news.indigo.ie> from Johny Begood
contained the following:
>Sorry Guys, one of my blonde moments,
>
>How do I generate a crosstab report, or a tabular report or an html table
>that looks like a crosstab report, using PHP?
Usually the output from a query is a number of rows each row being an
array of values. For instance with mysql you might do something like
this
$sql="Select etc etc";
$result=mysql_query($sql);
$result_table="<table>\n<tr>\n";
$result_table.=<th>col1</th><th>col1</th><th>col1</th>\n";
while($myrow=mysql_fetch_assoc($result)){
$result_table.="<tr>\n<td>$myrow[col1]</td><td>$myrow[col2]</td><td>$myrow[col3]</td>\n</tr>\n";
}
$result_table.="</table>";
echo $result_table;
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Navigation:
[Reply to this message]
|