Re: [PHP] multiple outputs to mysql_query()
on 7/8/01 5:53 AM, Adam at [EMAIL PROTECTED] 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? It might be a more simple way of doing it ... but I haven't tried it... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] multiple outputs to mysql_query()
> I'd do this: > > > echo ''; > > $result = mysql_query("SELECT * from table WHERE type='default'"); > $numrows = mysql_num_rows ($result); > > while ($numrows) { > > $row = mysql_fetch_row ($result); > echo "\n$row[0]\n"; > $row = mysql_fetch_row ($result); > echo "$row[0]\n"; > $numrows = ($numrows - 2); > } > > echo ''; > > ?> 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] multiple outputs to mysql_query()
on 7/8/01 3:39 AM, Adam at [EMAIL PROTECTED] wrote: > i want my mysql query result to output 2 mysql output rows for every > set. I'm used to just doing a do/while statement for a single mysql output > per row. I'd do this: '; $result = mysql_query("SELECT * from table WHERE type='default'"); $numrows = mysql_num_rows ($result); while ($numrows) { $row = mysql_fetch_row ($result); echo "\n$row[0]\n"; $row = mysql_fetch_row ($result); echo "$row[0]\n"; $numrows = ($numrows - 2); } echo ''; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]