jbrill Posted June 27, 2007 Share Posted June 27, 2007 Hey, Im trying to display a bunch of products which i am pulling from the database, but the tables they each show up in keep stacking on top of eachother, and not going beside eachother... I would like them to be 2 across, but like i said, they are only going one per line. I have tried some css tips with no luck... here is my code: <? include 'includes/dbconnect.php' ?> <table width="700" height="187" border="1"> <tr> <td height="104" valign="top"> <? $featuredresults = mysql_query("SELECT * FROM products Where publish=1 AND featured=1"); while($row = mysql_fetch_array($featuredresults)) { echo"<table width=\"250\" border=\"1\" >"; echo"<tr>"; echo"<td> </td>"; echo"</tr>"; echo"<tr>"; echo"<td> </td>"; echo"</tr>"; echo"<tr>"; echo"<td> </td>"; echo"</tr>"; echo"<tr>"; echo"<td> </td>"; echo"</tr>"; echo"</table>"; } ?> </td> </tr> <tr> <td> </td> </tr> </table> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted June 27, 2007 Share Posted June 27, 2007 not really a php question, but you are echoing them all in the same <td> try in the while command doing at the top <td> and at the end of the block </td> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted June 27, 2007 Share Posted June 27, 2007 you can work a php function into it <?php $rowcount = 0; while($row = mysql_fetch_array($featuredresults)) { $rowcount++; if ($rowcount%2 = 0) {echo "</tr><tr>";} echo "<td>"; echo"<table width=\"250\" border=\"1\" >"; echo"<tr>"; echo"<td> </td>"; echo"</tr>"; echo"<tr>"; echo"<td> </td>"; echo"</tr>"; echo"<tr>"; echo"<td> </td>"; echo"</tr>"; echo"<tr>"; echo"<td> </td>"; echo"</tr>"; echo"</table>"; echo "</td>"; } echo "</tr>"; ?> Quote Link to comment Share on other sites More sharing options...
jbrill Posted June 27, 2007 Author Share Posted June 27, 2007 ...still confused here... i am new to this php stuff haha Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted June 27, 2007 Share Posted June 27, 2007 try what i gave you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.