Forum Moderators: coopster
For my website I often use php to get a list of information. These lists are ordered by different variables on different pages.
What I want to do is get a number outputted which represents the place on which a certain listitem is outputted.
For instance this is the outputted list:
-Shirts
-trousers
-jackets
-hats
I then would like to be able to also show:
1 shirts
2 trousers
3 jackets
4 hats
I need this to be a variable or something like I output normal variables (<?php echo $row_Recordset1['outputnumber']; ?>) so I can use this to number the list and show special images before them (example.com/images/<?php echo $row_Recordset1['outputnumber']; ?>.jpg), so I cannot do this using an order list.
Anyone know how to do this?
[edited by: eelixduppy at 6:29 pm (utc) on Feb. 3, 2009]
[edit reason] disabled smileys [/edit]
Except I want to place it here:
<?php do { ?>
< OUTPUT THE NUMBER > <?php echo $row_Recordset4['name']; ?>
<?php } while ($row_Recordset4 = mysql_fetch_assoc($Recordset4)); ?>
So, Ive put a repeat region on the name, and for every name that turns up there must be a higher number...
Hope this clarifies, if you need info, please let me know.
$count = 0;
do {
// if you want it incremented every time:
++$count;
// increment based on some other logic:
if (name changed) {
++$count;
}
} while ();