Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-16 Thread Curt Zirzow
I got lost in the mix of threads, so here is my input on the situation. On Thu, Dec 15, 2005 at 09:53:46AM -0500, Rahul S. Johari wrote: > I want to assign a 4 Digit ID with leading zeros to each record added using > a form I have created. > > The PHP scripts does two things: > (a) It adds the d

Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread Rahul S. Johari
Ave, I did actually think about a periodic reset, as I do something like that for one other application, different issue. Thanks. On 12/15/05 1:24 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > If it's really a temporary table, then you can probably reset the auto > increment counter pe

Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread tg-php
If it's really a temporary table, then you can probably reset the auto increment counter periodically so you'll never hit . If it doesn't have to be 4 digits, that you just want it padded out with zeros, you can have the numbers in the databse be 1, 2, 3, 4 (regular, no padding) and just us

Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread Rahul S. Johari
Ave, Now that is an interesting perception. I didn't think about that. Well I can always change it to five or six. Let me re-assess this with the concerned person in the department and see what the scenario is like. I'll have to check the fluency of incoming data and expectancy of reaching the 10,

Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread Jim Moseby
Rahul S. Johari wrote: Ave, Primarily the application is for recycling some data. Things will be added by a client, shortly processed thereafter in-house, and removed. We won't be reaching the 10,000 records for this application. Thanks. Yes, but as I understand it, MySQL will continue to

Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread Rahul S. Johari
Ave, Yes phpMyAdmin does but I'm sure many other don't. I'll keep this in mind. Thanks. On 12/15/05 11:01 AM, "John Hinton" <[EMAIL PROTECTED]> wrote: > Rahul S. Johari wrote: > >> Ave, >> >> I'm looking into the ZEROFILL option now. Didn't know about it before but it >> looks promising and p

Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread Rahul S. Johari
Ave, Primarily the application is for recycling some data. Things will be added by a client, shortly processed thereafter in-house, and removed. We won't be reaching the 10,000 records for this application. Thanks. On 12/15/05 11:00 AM, "Jim Moseby" <[EMAIL PROTECTED]> wrote: >> >> I'm looking

Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread Rahul S. Johari
Ave, That Worked!! That was the perfect solution. Everything is working just the way I wanted it to work now. I'm using ZEROFILL in my mySQL table and pulling the ID to generate the filename. Thanks a TON! On 12/15/05 10:17 AM, "David Grant" <[EMAIL PROTECTED]> wrote: > Rahul, > > Rahul S. Jo

Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread Anas Mughal
The suggestions made are all great. However, I have a problem understanding the requirement of having the Id in the database matchup with the filename. (You could always append the when binding the database Id with the filename.) Please elaborate on your requirements. Thanks. On 12/15/05, Jim

RE: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread Jim Moseby
> > I'm looking into the ZEROFILL option now. Didn't know about > it before but it > looks promising and probably is my solution. I'll get back. Obviously, with a 4 digit id, you will only be able to store 10,000 records. If I recall correctly, MySQL auto-increment fields will not reuse id's whe

Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread John Hinton
Rahul S. Johari wrote: Ave, I'm looking into the ZEROFILL option now. Didn't know about it before but it looks promising and probably is my solution. I'll get back. Thanks a ton! On 12/15/05 10:24 AM, "Jim Moseby" <[EMAIL PROTECTED]> wrote: Zerofill in mysql will do it. But, many mysql 'c

Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread Rahul S. Johari
Ave, I'm looking into the ZEROFILL option now. Didn't know about it before but it looks promising and probably is my solution. I'll get back. Thanks a ton! On 12/15/05 10:24 AM, "Jim Moseby" <[EMAIL PROTECTED]> wrote: >> >> What I would have preferred to have is make both the ID in >> mySQL t

RE: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread Jim Moseby
> > 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. Then, take the suggestion of another respondent to this topic, and have a look at MySQL's "ZEROFILL" option. I'm not sure if you can u

Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread Rahul S. Johari
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

Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread David Grant
Rahul, Rahul S. Johari wrote: > The 4 Digit ID (beginning from 0001) will be used in two places: > (a) It will be the ID for the record in the mySQL table, instead of the > usual ID that we create in mySQL. It will be a Primary Key, Not Null, > Auto_Increment Adding ZEROFILL to that definition mi

RE: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread Jim Moseby
> > 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=mys

Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread Robin Vickery
On 12/15/05, Rahul S. Johari <[EMAIL PROTECTED]> wrote: > Ave, > > I want to assign a 4 Digit ID with leading zeros to each record added using > a form I have created. > > The PHP scripts does two things: > (a) It adds the data to a mySQL table > (b) it generates a CSV file with the data > > The 4

[PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread Rahul S. Johari
Ave, I want to assign a 4 Digit ID with leading zeros to each record added using a form I have created. The PHP scripts does two things: (a) It adds the data to a mySQL table (b) it generates a CSV file with the data The 4 Digit ID (beginning from 0001) will be used in two places: (a) It will be