0

I have created a form in PHP and MySQL. After submitting the data, it is saved into the MySQL table. But I have got a problem: If the form contains an apostrophe then there will be an error while inserting the data, so how can i remove the apostrophe from the post variable?

$description=$_POST['description'];
Matthew Poer
  • 1,682
  • 10
  • 17
Gijo Varghese
  • 11,264
  • 22
  • 73
  • 122

1 Answers1

1

You need to escape characters, to stop them from breaking your SQL statements. I recommend you read up on SQL injections. I think this is taken care of automatically in the mySQLi extension, which you should be using as this method is depreciated nowadays.

 $descrtion = mysql_real_escape_string($_POST['description']);