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> Link to comment https://forums.phpfreaks.com/topic/57445-displaying-tables-inline-from-php-need-a-quick-answer-thnx/ 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> Link to comment https://forums.phpfreaks.com/topic/57445-displaying-tables-inline-from-php-need-a-quick-answer-thnx/#findComment-284221 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>"; ?> Link to comment https://forums.phpfreaks.com/topic/57445-displaying-tables-inline-from-php-need-a-quick-answer-thnx/#findComment-284228 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 Link to comment https://forums.phpfreaks.com/topic/57445-displaying-tables-inline-from-php-need-a-quick-answer-thnx/#findComment-284234 Share on other sites More sharing options...
cooldude832 Posted June 27, 2007 Share Posted June 27, 2007 try what i gave you Link to comment https://forums.phpfreaks.com/topic/57445-displaying-tables-inline-from-php-need-a-quick-answer-thnx/#findComment-284238 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.