SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict ketting00's Avatar
    Join Date
    Jul 2011
    Posts
    325
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Why my list shows double value of item number

    Hello everyone,
    Here's the code I want to solve:
    Code:
    <?php
    	$result = mysql_query("SELECT id, uid, name, amount FROM lists WHERE uid = '$id' ORDER BY id DESC LIMIT 5");
    	$i = 1;
    	while ($row = mysql_fetch_assoc($result)) { ?>
    	<ul id='list'>
    		<li>
    		<?php
    			echo "<div class='num'>",$i++,"</div>";
    			echo "<div class='name'>",$row['name'],"</div>";
    			echo "<div class='amount'>",$row['amount'],"</div>";
    		?>
    		</li>
    	</ul>
    <?php } ?>
    It displays as below:
    Code:
    Items	Name	Amount
    2		A		1
    4		B		6
    6		C		10
    I want it to be displayed like this:
    Code:
    Items	Name	Amount
    1		A		1
    2		B		6
    3		C		10
    Thank you,

  2. #2
    SitePoint Addict ketting00's Avatar
    Join Date
    Jul 2011
    Posts
    325
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Never mind I just divide the value by 2.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •