Product display PROBLEM with PHP + CSS

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Angelos

    Product display PROBLEM with PHP + CSS

    Hello,
    I have the folowing code looping thru a result set from the Database and
    displaying a list of products.
    I want to use CSS to display 3 products for each line ... or any number of
    products that will fit in a line and look nice.
    So from the php side How can I do something for every 3 records e.x every 3
    records echo "<ul>".

    Without any CSS it will display them vertically....

    /*************** *************** *************** ******/
    echo "<ul>";
    while ($row_newProd=m ysql_fetch_asso c($new_products ))
    {?>

    <li>
    <?php echo $row_newProd['products_shrt_ desc']; ?><br>
    <div align="center"> <a href="index.php ?products_id=<? php echo
    $row_newProd['products_id']; ?>"><img src="/images/thumb_<?php echo
    $row_newProd['products_img']; ?>" border="0" ></a></div>
    <p><?php
    display_product _price($row_new Prod['products_price '],$row_newProd['products_offer ']);
    ?></p>
    </li>

    <? }
    echo "</ul>";

    /*************** *********/
    css:

    #new_products ul {
    margin:0px;
    list-style-type: none;
    text-align:center;
    padding: 0px;
    }
    #new_products ul li {
    font-size:0.8em;
    display:inline;
    float:left;
    /*border: 1px dashed #CCCCFF;*/
    width:30%;
    margin:2px;
    }
    /*************** *************** ********/

    If you've done something like that, you know what I mean.
    So if you have any Idea give me a hint please.

    Regards
    Angelos.


Working...