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.

 

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.