Re: newbie: MySQL importing data from a variable
| From: | (Miles Thompson) | Date: | Mon, 12 Mar 2001 14:31:27 +0000 |
| Subject: | Re: newbie: MySQL importing data from a variable | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43471@lists.php.net to get a copy of this message | ||
No problem.
Initialize the counter before your loop, like so: $counter = 1;
In the loop, print out the value of the counter and increment it by 1: echo $counter++;
The "++" added to counter instructs PHP to increase the value by 1 AFTER the operation and is a shorthand way of saying
echo $counter;
$counter = $counter + 1;
If the second way is clearer to you, and you feel more comfortable with it, do it that way.
It will be well worth your time visiting www.thickbook.com and doing Julie Meloni's tutorials. She covers a lot of basic principles very clearly. You can also pick up a LOT of useful information on PHP at phpessentials, devshed, zend.com and so forth.
Have fun - Miles
At 11:00 AM 3/12/01 -0800, Gavin Tong wrote:
Miles, thank you for your prompt reply and suggestion. My problem is that I am an absolute beginer, not only to php, but to programing in general. I understand the logic of the counter but my attempts to add it into the script have failed. Any direction you could give me would be greatly appreciated. Thanks again, Gavin Tong