Tables inside of divs
Posted: Wed Jun 22, 2011 12:22 am
How can I put a table inside of a div? I tried doing this.
But for some reason that div only moved everything down the number of pixels in the div and not just the code right there even tho I closed the div.
Without divs it turns out like this

The one right below the 'Items to add' is not correct there. That table should be under the 'Shop inventory' So as you can see it is very mixed up so I tried using divs, which didn't work as I expected. Does anyone see what I am doing wrong?
Code: Select all
echo "<u><b>Shop inventory:</b></u>";
echo "<div id='invshop1'><div align='left'>";
echo "<table border='0' width='70%' cellspacing='20'>";
echo "<tr><td width='25%' valign='top'>";
echo "</td>";
echo "<td valign='top' width='75%'>";
$selectshopinv="SELECT * from materialshop where shop_id='$shop_id' ORDER BY name";
$selectshopinv2=mysql_query($selectshopinv) or die("could not select shop inventory");
echo "<table border='1' bordercolor='white' bgcolor='#23A0A8'>";
echo "<tr><td>Name<font color='23A0A8'>________</td><td>Type<font color='23A0A8'>____</td><td>Modifies<font color='23A0A8'>__</td><td>Price<font color='23A0A8'>_______</td></tr>";
while($selectshopinv3=mysql_fetch_array($selectshopinv2))
{
$mastertable = $selectshopinv3['class'];
$selectiteminfo="SELECT * from $mastertable where name='$selectshopinv3[name]'";
$selectiteminfo2=mysql_query($selectiteminfo) or die("could not select item info");
$selectiteminfo3=mysql_fetch_array($selectiteminfo2);
echo "<tr><td>$selectshopinv3[name]</td><td>$selectiteminfo3[type]</td><td>$selectiteminfo3[modif]</td><td>$selectiteminfo3[value]</td></tr>";
}
echo "</center></div>"; Without divs it turns out like this

The one right below the 'Items to add' is not correct there. That table should be under the 'Shop inventory' So as you can see it is very mixed up so I tried using divs, which didn't work as I expected. Does anyone see what I am doing wrong?