Jump to content

Displaying database information in columns


Wardy_7

Recommended Posts

I have a database with products in and I want iT to automatically show every product on the page. Now I am able to do this easy enough but what I am struggling to do is that I want the products to be displayed in 3 columns. I can get them to display one under the other easy enough but I want them to be in rows with 3 columns instead.

 

Can anyone please help.

 

echo("<table>"); 
      
    while($row = mysql_fetch_array($result)){ 
        if ($bgcolor == "#F7DF42"){ 
            $bgcolor = "#FFFFFF"; 
        }else{ 
            $bgcolor = "#F7DF42"; 
     } 
    echo("<tr bgcolor=".$bgcolor.">\n<td>"); 
    echo('<a href="../products/' . $row["product_code"] . '">' . $row["description1"] . '</a>'); 
    echo('<img src="' . $row["small_image"] . '" alt="' . $row["description1"] . ' ' . $row["description2"] . '"></a>'); 
    echo("</td>\n"); 
    } 

    echo("</table>");

 

Cheers

Wardy

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.