0

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 } ?>

Edited by diafol: closing thread

4
Contributors
5
Replies
7
Views
4 Years
Discussion Span
Last Post by Bachu
-1

so where is the help ?
could you show me ?

Votes + Comments
You gotta learn to be patience
0

@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.

Edited by LastMitch: grammer

0

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.

Edited by diafol

Votes + Comments
If you aren't good on something so don't try to give some advice just help if u can else be quite
Very Courteous !
1
<?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.

Edited by Bachu

Votes + Comments
Thanks