Jump to content

Displaying tables inline from php! need a quick answer! thnx


jbrill

Recommended Posts

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>

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>";
?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.