hi every body
i want to show in each row 4 items from my db and go to another row (++row)
in each row 4 items until end of items of db instead of in each row 1 item
please help me

here is the code

<?php
$sql=mysql_query("SELECT * FROM `products` where tf=1 and star='7' ORDER BY `id` DESC");
$inc = 0;
while($r=mysql_fetch_array($sql)){

    $id=$r['id'];
    ?>
<div style="width:152px; height:205px;">

<?php echo $id; ?>
</div>
<?php } ?>

Recommended Answers

All 5 Replies

so where is the help ?
could you show me ?

commented: You gotta learn to be patience -1
Member Avatar for LastMitch

@mahdiyazdani

so where is the help ?
could you show me ?

That is really uncall for! Down Vote for what? I was about to help you but since you have issues now. I'm not going to help you at all.

Member Avatar for diafol

This is a duplicate thread. Could I suggest some restraint with regard to the downvotes guys? As LM states - patience - we are not here at your beck and call. Being rude to contributors will only result in us not helping you AT ALL. Carry on here; http://www.daniweb.com/web-development/php/threads/435834/display-items if you really want to.

commented: Very Courteous ! +5
commented: If you aren't good on something so don't try to give some advice just help if u can else be quite +0
<?php
$sql=mysql_query("SELECT * FROM `products` where tf=1 and star='7' ORDER BY `id` DESC");
$inc = 0;
while($r=mysql_fetch_array($sql)){
    $inc++;
    $id=$r['id'];
    ?>
<div style="width:152px; height:205px;">

<?php echo $id; ?>
</div>
<?php 
    if($inc%4==0) echo '<hr />';
} 
?>

Here I have seperated each 4 items by hr tag.. This will help you... to know how to
seperte items.

commented: Thanks +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.