Jump to content

[SOLVED] Inserting $POST data in MySQL


DataRater

Recommended Posts

This is the situation

 

magic_quotes_gpc = Off

 

I am inserting into a MySQL table (Ive simplified the code below e.g. I have put the $POST data into a simple variable)

 

$sql="INSERT INTO yachts SET

      id='".$id."',

      name='".$name."',

      manufacturer='".$manufacturer."',

      ..."

Now I should wrap add_slashes() around each of these like this to make the insert nice and tidy for MySQL so that would be

 

$sql="INSERT INTO yachts SET

      id='".add_slashes($id)."',

      name='".add_slashes($name)."',

      manufacturer='".add_slashes($this->manufacturer)."',

      ..."

 

but add_slashes() doesn't, apparently, do the whole job due to it not escaping certain (I don't know what they are) characters which might be injected by unscrupulous types.

 

So what do I need to do make this very tidy?

 

Link to comment
https://forums.phpfreaks.com/topic/119634-solved-inserting-post-data-in-mysql/
Share on other sites

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.