Moron Posted July 27, 2009 Share Posted July 27, 2009 This is probably dirt simple but I can't seem to think of the function at the moment (see my username). 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. Quote Link to comment Share on other sites More sharing options...
zq29 Posted July 27, 2009 Share Posted July 27, 2009 Regular Expression? echo (preg_match("/^([A-Z]+)$/i",$str)) ? "Alpha" : "Not Alpha"; Quote Link to comment Share on other sites More sharing options...
Moron Posted July 27, 2009 Author Share Posted July 27, 2009 Regular Expression? echo (preg_match("/^([A-Z]+)$/i",$str)) ? "Alpha" : "Not Alpha"; Thanks. How would I use this against my database field? Quote Link to comment Share on other sites More sharing options...
vineld Posted July 27, 2009 Share Posted July 27, 2009 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. Quote Link to comment Share on other sites More sharing options...
Moron Posted July 27, 2009 Author Share Posted July 27, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.