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>

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.