Re: RE: [PHP] Printing MySQL into HTML Tables
| From: | JJeffman | Date: | Fri, 23 Mar 2001 22:31:17 +0000 |
| Subject: | Re: RE: [PHP] Printing MySQL into HTML Tables | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-7738@lists.php.net to get a copy of this message | ||
Congratulations !! Very good solution ! Simple and efficient !
Cheers,
Jayme.
-----Mensagem Original-----
De: Michael Rudel <mru@suchtreffer.de>
Para: <b.a.verbeek@wanadoo.nl>; 'PHP-DB mailinglist' <php-db@lists.php.net>;
<jeff@webdesigns1.com>
Enviada em: sexta-feira, 23 de março de 2001 08:29
Assunto: RE: [PHP-DB] RE: [PHP] Printing MySQL into HTML Tables
> Or try this one, its simple but more universal and very usefull for eg.
testing.
> ... and a bit mor structured >8)=)
>
> <?php
> function result_all( $sql_result )
> {
> echo "<TABLE>\n";
>
> $columns = mysql_num_fields( $sql_result );
>
> for ( $i = 0; $i < $columns; $i++ )
> {
> echo " <TH> ".mysql_field_name( $sql_result, $i )."
</TH>\n";
> }
>
> while ( $row = mysql_fetch_row( $sql_result ) )
> {
> echo " <TR>\n";
>
> for ( $count = 0; $count < $columns; ++$count )
>
>
> echo " <TD> ".$row[$count]." </TD>\n";
> }
>
> echo " </TR>\n";
> }
>
> echo "</TABLE>\n";
> }
> ?>
>
> Greetinx,
> Mike
>
> Michael Rudel
> - Web-Development, Systemadministration -
> _______________________________________________________________
>
> Suchtreffer AG
> Bleicherstraße 20
> D-78467 Konstanz
> Germany
> fon: +49-(0)7531-89207-17
> fax: +49-(0)7531-89207-13
> e-mail: mailto:mru@suchtreffer.de
> internet: http://www.suchtreffer.de