Re: generating next number... from db extraction
| From: | Tom Rogers | Date: | Thu, 30 May 2002 05:56:31 +0000 |
| Subject: | Re: generating next number... from db extraction | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-99854@lists.php.net to get a copy of this message | ||
Hi
You could use the auto increment feature of mysql and store the prefix and suffix as seperate fields in the database like
idnum|prefix|suffix|data........
1234:abc|A
Then just add them together to form the complete order number.
Tom
At 10:27 AM 30/05/2002 +1000, Peter wrote:
hi, I'm making a quoting system and need to have letters & Numbers inside the quote number. Now if I was to grab the last quote number inserted into the db and then do something like //example of $quoteID value w/out letters $quoteID = 20120250; //example of $quoteID with letters //$quoteID = abc20250; $quoteNUM = $quoteID + 1; echo $quoteNUM; it will work fine .. but the minute i add a letter to this is doesn't... now I know I can generate random numbers and letters but I need to have some order about it so the quote numbers are not all over the place... Also as an addition providing I can get this working .. I would also like to have it so that if a quote was updated the quoteID would be changed ... eg: if the quote number was abc20250 after it was updated it would be abc20250-A or something along those lines ... Cheers Peter "the only dumb question is the one that wasn't asked" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php