multiple outputs to mysql_query()
| From: | Adam | Date: | Sun, 08 Jul 2001 07:39:17 +0000 |
| Subject: | multiple outputs to mysql_query() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-56730@lists.php.net to get a copy of this message | ||
i want my mysql query result to output 2 mysql output rows for every <tr>
set. I'm used to just doing a do/while statement for a single mysql output
per row.
example:
//the code i have essentially does this
-----------------------------------------
<?php
echo '<table>';
$result = mysql_query("SELECT * from table WHERE type='default'");
do {
echo '<tr><td>
' . $myresult[column] .
'</td></tr>';
} while ($myresult == mysql_fetch_array($result));
echo '</table>';
?>
--------------------
//outputs:
<table>
<tr>
<td>data for row 1</td>
</tr>
<tr>
<td>data for row 2</td>
</tr>
...etc...
</table>
-------------------------------------------
i want it to output like this:
<table>
<tr>
<td>data for row 1</td>
<td>data for row 2</td>
</tr>
<tr>
<td>data for row 3</td>
<td>data for row 4</td>
</tr>
...etc...
</table>
------------------------------------------
if anyone can help me with alternating like this or knows where i can find a
resource tutorial on it please tell me..
thanks
-Adam