Jump to content

remove NON alphanumeric characters from a string


poe

Recommended Posts

Well, if you're putting data into a a database, you don't exactly have to worry about anything alpha numeric....

 

So in theory if you replaced anything not alphanumeric with "", then you would be perfectly safe....

 

The only problem is, when inserted data, you wouldn't get the entire data so you would want to check against the original value and make sure the user won't get some weird error....

 

For example, if you had a login script and two users made names....

 

One could make "phpguy" and another could make "php guy" and all the sudden MySQL is pulling two rows for that name because the replace would rip the space.

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.