Ave,

I think this will work for me.
Here's what I'm gonna do...

When the form is submitted:
First, add the records to the mySQL table. An ID will be automatically
generated.

Then, call the ID from the mySQL table, using your code, add the leading
Zeros to it, and generate the CSV file with that new ID as the filename.

The only issue that I still have is... The file name will be "0001.csv",
while in the mySQL table, the ID for that record who's csv file has been
generated, will be "1".

What I would have preferred to have is make both the ID in mySQL table and
the filename have the leading zeros. But I'm not sure if that's possible.

Thanks.

On 12/15/05 10:10 AM, "Jim Moseby" <[EMAIL PROTECTED]> wrote:

>> 
>> I¹m trying to figure out how to do this but am not sure.
>> Any help appreciated.
>> 
> 
> I'm not sure of what you are asking, but I'll assume that because you posted
> the to the PHP list, that you are asking how to take a MySQL autoincrement
> number and add leading zeros to it.
> 
> Try this: 
> 
> $row=mysql_fetch_array($result);
> $four_digit_id=str_pad($row['id'], 4, "0", STR_PAD_LEFT);
> 
> JM

Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
251 River Street
Troy, NY 12180

Tel: (518) 266-0909 x154
Fax: (518) 266-0909
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to