output mysql into divs not a table

Soldato
Joined
7 Jan 2007
Posts
10,607
Location
Sussex, UK
How do I output the results into 3 container divs? with each of the divs assigned their own div so I can manipulate company, product and price later with css?

PHP:
        $query =    ("SELECT * 
                        FROM company
                        JOIN products
                        ON company.idcompany = products.idcompany JOIN price
                        ON products.idProducts = price.idproduct
                        ORDER BY price DESC
                        LIMIT 3");
                    
                    
$result = mysql_query($query) or die(mysql_error());

// Print out the contents of each row into divs
while($row = mysql_fetch_array($result)){
    echo $row['company]. " ". $row['product']. " ". $row['price'];


}
 
Yeh sure,

http://overclockers.co.uk/

On the OCUK home page you have the container div underneath the javascript slider with 3 seperate ones for bundles, systems and portables. I know ocuk have put there data into a table but I would like something similar for my site but in divs not a table.

essentially I want to create this

<div class="top3">

<div class="company">company 1 output</div>

<div class="product">product 1 output</div>

<div class="price">price 1 output</div>

</div>

<div class="top3">


<div class="company">company 2 output</div>

<div class="product">product 2 output</div>

<div class="price">price 2 output</div>
</div>

<div class="top3">

<div class="company">company 3 output</div>

<div class="product">product 3 output</div>

<div class="price">price 3 output</div>

</div>
 
Back
Top Bottom