Incrementing numerical part of an alphanumerical value
Posted on 2007-08-03
I have existing alphanumeric values in a mysql db field that is of the following format:
the "111" can be anything from just "1" to "99999", while the "XYZ" is fixed to 3 alpha characters, and the "22" is anything between "01 and 12 - (months)"
I want to first of all determine the largest "111" value that is currently in the DB, then increment it by 1, append a $_POST var containing the alpha values and then append the last two digits to form a new alpha string.
I'm not real good with regexp etc, so I'm battling with the query as well as "extracting" just the first numerical part so I can increment it.