Brent Clark wrote:

Hi all

for some reason I seem to be having a problem having to do a look up in a mysql table
and the take the result of that query and then perform the right action.

Basically I need to do a look up for a file for example

10006547.pdf.

I then need to:
        if no letter of the alphabet is present.
            then make it 10006547A.pdf
    else if does exist, make it 10006547B.pdf

for some reason I cant seem to pull this off, add I honestly thought is would be a simple function.

If anyone knows of a URL or can help in anyway

preg_match() to find the letter (or no letter if there is not any)
ord() will give you the ASCII value of the character, you can now add 1 to it, watch for the ceiling (Z)
chr() to give you the letter from the new ASCII value


Don't forget to lock your table to be safe from simultaneously running requests:
myqsl_query('LOCK TABLES tbl_name [AS alias] {READ | WRITE}');


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



Reply via email to