Forum Moderators: coopster
result1 result2
result3 result4
result5 etc.
ive tried a few things like:
$query="SELECT * from tablename";
$result=(mysql_query($query));
while ($myrow=mysql_fetch_array($result)){
$tablebreak=1;
if ($tablebreak==1){
echo('<table width="600" colspan=2 border=1><tr><td>'.$myrow[1].'</td>');
$tablebreak++;
}
else {
echo('<td>'.$myrow[1].'</td></tr></table><br>');
}
but it just outputs single cell tables with <br>'s between them and no </table> tags.
any ideas anybody?
help would be hugely appreciated.
thanks
$query="SELECT * from tablename";
$result=(mysql_query($query));
$tablebreak=1;
echo '<table width="600" border=1>';
while ($myrow=mysql_fetch_array($result)){
if ($tablebreak == 1) {
echo '<tr><td>'.$myrow[1].'</td>';
$tablebreak = 2;
} else {
echo '<td>'.$myrow[1].'</td></tr>';
$tablebreak = 1;
}
}
//check to make sure the last row and final cell were output
if ($tablebreak == 2) echo '<td> </td></tr>';
echo '</table>':