Why does it have to be letters and numbers? You're just making more
work. You can use an auto_increment field and not worry about it
(assuming MySQL). 

You can also use uniqid() and md5() to make a unique string, but it'll
be 32 characters long. Maybe crypt() is 16 characters...dunno, but you
could try that.


---John Holmes...

> -----Original Message-----
> From: Peter [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 29, 2002 8:28 PM
> To: Php
> Subject: [PHP] generating next number... from db extraction
> hi,
> I'm making a quoting system and need to have letters & Numbers inside
> quote number. Now if I was to grab the last quote number inserted into
> 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
> now
> I know I can generate random numbers and letters  but I need to have
> order about it so the quote numbers are not all over the place... Also
> an
> addition providing I can get this working .. I would also like to have
> so
> that if a quote was updated the quoteID would be changed ... eg:  if
> quote number was abc20250 after it was updated it would be abc20250-A
> 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

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

Reply via email to