Jump to content

Check if a field contains an alpha character?


Moron

Recommended Posts

This is probably dirt simple but I can't seem to think of the function at the moment (see my username).      8)

 

What function checks to see if a database field contains an alpha character?

 

If a person has a middle initial, I want to put a period after it. If no middle initial, then no period.

 

Thanks.

 

 

 

Regular Expression?

 

echo (preg_match("/^([A-Z]+)$/i",$str)) ? "Alpha" : "Not Alpha";

 

Thanks. How would I use this against my database field?

 

He probably meant to suggest that you will have to iterate through all rows and update accordingly using php. This is something you should to prior to inserting thereafter.

Regular Expression?

 

echo (preg_match("/^([A-Z]+)$/i",$str)) ? "Alpha" : "Not Alpha";

 

I see. Well... is there a way to just simply use a form of "not blank?"

 

Thanks. How would I use this against my database field?

 

He probably meant to suggest that you will have to iterate through all rows and update accordingly using php. This is something you should to prior to inserting thereafter.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.