Link to home
Start Free TrialLog in
Avatar of psimation
psimationFlag for South Africa

asked on

Incrementing numerical part of an alphanumerical value

Hi

I have existing alphanumeric values in a mysql db field that is of the following format:

111XZY22

some examples:

12BFM02
437AFM12
1023CFZ08

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.

 
ASKER CERTIFIED SOLUTION
Avatar of MasonWolf
MasonWolf
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial