Hi, i have the information printing into the table into 3 columns and this works fine but i now want the last row that is printed to align in the center. For example on the last row there is only 1 entry of info i want it to align in the middle or if there is 2 entries of info i want them to spread evenly across the page rather than entering into column 1 then 2 then 3.
Any help?
<body>
<?php
include('header.php');
?>
<p align="center"><font size="+3" color="#00793A"><u>Drinks</u></p>
<?php
$i = 1;// no of columns so far
//Step 1 Make a Connection
mysql_connect('localhost', 'root', '');
//Step 2 Select the Database
mysql_select_db('shoppingcart');
//Step 3 Make the SQL
$query="SELECT * FROM product WHERE ptype='drink' ORDER BY pname ASC";
//$query="SELECT pname, description, price, quantity FROM product ORDER BY userid ASC";
//$query="SELECT CONCAT(image, ' <br> ',pname, ' <br> ' , description) AS details FROM product ORDER BY pname ASC";
$result = mysql_query($query);
//$row = mysql_fetch_array($result, MYSQL_NUM); //MYSQL_ASSOC //MYSQL_BOTH
//echo $row;
//while($row = mysql_fetch_array($result, MYSQL_NUM))
echo '<table align="center" bordercolor="black" width="90%" >';
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo '
<td align="center" width ="33%">
<table width ="300" border="1" bordercolor="#00793A">
<tr><td width="33%">
<font size="2pt" face="arial" color="#00793A">'.'<img src=' .$row['image']. ' border="0" width="100" height="100" /> '.' <br> Name - '.$row['pname'].' <br> Description - '.$row['description'].' <br> Price - £'.$row['price'].' <br> Quantity - '.$row['quantity'].' <br>
<a style="color: #000000;" href="my_cart.php?action=add_item&id='.$row['pid'].'&qty=1">Buy Me
</a></font></td></tr></table><br></td>
';
//echo $row[0] . " " . $row[1] . " " . $row[2] . " " . $row[3] . " " . $row[4] . " " . $row[5];
//echo $row[userid] . " " . $row[first_name] . " " . $row[last_name] . " " . $row[email] . " " . $row[password] . " " . $row[registration_date];
//echo $row['first_name'] . " " . $row['last_name'] . " " . $row['email'] . " " . $row['registration_date'];
if($i==3)
{
print "</tr>\n<tr>\n";
$i = 1;
}
else
{
$i++;
}
}
echo '</table>';
?>
</body>
Many Thanks
Jack M