Re: Simple Math
| From: | Zak Greant | Date: | Tue, 27 Jun 2000 17:45:57 +0000 |
| Subject: | Re: Simple Math | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-3378@lists.php.net to get a copy of this message | ||
At 10:35 AM 6/27/00 -0700, Phillip S. Baker wrote:
I know this is pretty basic, but I am not finding out how to do this in the mathical functions area of the manual. I am pulling a list of items out of a DB using a while statement. Now I want to dynamically generate numbers for the list based on how many items are pulled up, not based on an ID in the DB. So for the first item I would always liek to start with 1 and for the next item that appears in the array to add one and so forth to get a numbered list. How would I do this?Before your while loop: $index_number = 1; Inside your while loop: print "....$index_number"; ++$index_number; Or use a for loop for ($i=1; $row = mysql_fetch_array ($result); ++$i) {
print "....$i";} HTH, Zak Greant Creative Director Nucleus Information Service Inc. "A camel is a horse designed by a committee." - Alex Issigonis (Designer of the Mini)