|
Posted by L C on 06/14/07 15:34
"Ivαn Sαnchez Ortega" <ivansanchez-alg@rroba-escomposlinux.-.punto.-.org>
wrote in message news:f4rloi$1b4$1@hercules.cohp1...
> L C wrote:
>
> > I am outputting tables. The stuff I am doing is for a golf league. If
I
> > output scores it comes out like this.
>
> Loop through the results (RTFM!), outputting "<table>", "<tr>" and "<td>"
> where appropiate.
>
> --
> ----------------------------------
> Ivαn Sαnchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
>
> http://acm.asoc.fi.upm.es/~mr/
> Proudly running Debian Linux with 2.6.20-1-amd64 kernel, KDE 3.5.7, and
PHP
> 5.2.3-1 generating this signature.
> Uptime: 17:12:19 up 13 days, 23:14, 3 users, load average: 3.50, 2.67,
> 2.03
>
RTFM?
Loop through the results (RTFM!), outputting "<table>", "<tr>" and "<td>"
where appropiate
Like This?
echo "<table border='1'><tr>";
// printing table headers
for($i=0;
$i<$fields_num; $i++){ $field = mysql_fetch_field($result);
echo "<td>{$field->name}</td>";}echo "</tr>\n";
// printing table rows
while($row = mysql_fetch_row($result)){ echo "<tr>";
// $row is array... foreach( .. ) puts every element
// of $row to $cell variable
foreach($row as $cell)
echo "<td>$cell</td>";
echo "</tr>\n";
}
mysql_free_result($result);
?>
</body></html>
I have RTFMed my way to this point. A week ago I didn't have PHP, MySQL, or
IIS installed on my system. I didn't ask some generic question like: "How
do I get PHP". I asked what I thought was a relatively specific question
after searching the web for answers. I did search for PHP, MySQL, and
format. I got many hits about date formats. Unfortunately, unlike you, I
wasn't born knowing everything, I had to ask questions along the way. I am
sorry I bothered you with my question.
[Back to original message]
|