Re: [PHP] multiple outputs to mysql_query() From: Adam (adam <email protected>)
Date: 07/08/01

> I'd do this:
>
> <?php
>
> echo '<table>';
>
> $result = mysql_query("SELECT * from table WHERE type='default'");
> $numrows = mysql_num_rows ($result);
>
> while ($numrows) {
>
> $row = mysql_fetch_row ($result);
> echo "<tr>\n<td>$row[0]</td>\n";
> $row = mysql_fetch_row ($result);
> echo "<td>$row[0]</td>\n</tr>";
> $numrows = ($numrows - 2);
> }
>
> echo '</table>';
>
> ?>

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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>