[ 1 ][ 2 ][ 3 ][ 4 ][ 5 ][ 6 ][ 7 ][ 8 ][ 9 ]
I have desperately tried 3 different tutorials for implementing columns but i have had no success.
Please modify my code so it outputs like this:
[ 1 ][ 2 ][ 3 ]
[ 4 ][ 5 ][ 6 ]
[ 7 ][ 8 ][ 9 ]
(loops the code 3 times then inserts a </tr><tr> then does 3 next rows in database and so on...)
Here is my code: (to view what the output currently looks like go to: http://www.logicalreef.com/zoos.php )
Code: Select all
<table border="0" cellpadding="0" cellspacing="0" width="580" class="global">
<tr>
<td align="center">
<table width="100%%" border="0">
<tr>
<?
mysql_pconnect("localhost","username","password");
mysql_select_db("databasename");
$result = mysql_query("select * from zoos ");
while($r=mysql_fetch_array($result))
{
$zooID=$rї"zooID"];
$avail=$rї"avail"];
$price=$rї"price"];
?>
<?php
if($avail=="avail")
{
$status = "<td align='center' class='greencell'>Available</td>";
}
elseif($avail=="sold")
{
$status = "<td align='center' class='redcell'>Sold</td>";
}
elseif($avail=="hold")
{
$status = "<td align='center' class='orangecell'>On Hold</td>";
}
if($avail=="sold")
{
$disabled = "#";
}
elseif($avail=="hold")
{
$disabled = "#";
}
elseif($avail=="avail")
{
$disabled = "query.php?zooID=$zooID&set=sold&userid=$userid";
}
?>
<td align="center"> <table width="150" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td><table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td align="left" bgcolor="#666666"><font color="#FFFFFF"> <?php echo "$zooID" ?></font></td>
<td align="right" bgcolor="#666666"><font color="#FFFFFF"><strong>$<?php echo "$price" ?> </strong></font></td>
</tr>
</table></td>
</tr>
<tr>
<td><a href="sale/<?php echo "$zooID" ?>big.jpg"><img src="sale/<?php echo "$zooID" ?>.jpg" alt="<?php echo "$zooID" ?>" border="0"></a></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> <?php echo "$status" ?>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
<?php } ?>
</tr>
</table></td>
</table>