Re: multiple outputs to mysql_query()
| From: | zerosumzero@yahoo.com | Date: | Sun, 08 Jul 1979 18:36:43 +0000 |
| Subject: | Re: multiple outputs to mysql_query() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-56791@lists.php.net to get a copy of this message | ||
on 7/8/01 5:53 AM, Adam at adam@wangallery.com wrote:
> thanks so much for the help, that'll be a great reference for any other
> similar types of output i need.
>
> some things i had to fix for others viewing this thread:
>
> "while ($numrows)" had to be changed to "while ($numrows >= 1)" or the
> while
> statement would loop forever. (server hangup)
>
> i had to accomidate and if statement to check if the amount of $numrows left
> was <= 1
>
> -Adam
Have you tried this?
<?php
echo '<table';
$result = mysql_query("SELECT * from table WHERE type='default'");
while (mysql_fetch_row ($result)) {
echo "<tr\n<td$row[0]</td\n";
$row = mysql_fetch_row ($result);
echo "<td$row[0]</td\n</tr";
}
echo '</table';
?>
It might be a more simple way of doing it ... but I haven't tried it...