Jump to content

Inserting apostrophe into a record mySQL?


feakazoid

Recommended Posts

Hi guys,

 

I was wondering how i would go about inserting data with an apostrophe in it using sql.

 

Currently i am inserting data like this

 

"INSERT into table(field)
values('$feild')";

 

Obviously when $feild contains an apostrophe this causes problems, what is the solution to this problem?

This is a security vulnerability.

 

For more information on this there are plenty of tutorials:

search for "Mysql Injection php" on http://www.google.com/

 

There is also another common mysql vulnerability whereby fields like username fields etc can hold javascript, when the username gets displayed on a page so does the javascript, and they can do some pretty nasty things :P.

 

For All Other Security issues google "PHP Security", phpfreaks has a tutorial on this also.

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.