Jump to content

Apostrophe breaking MySQL query


qwerty234

Recommended Posts

The variable $tools has an apostrophe ' in it. This kills the query. I have tried mysql_real_excape_string($tools) and stripslashes($tools) to no avail as you can see. Any ideas?

 

    $sql  = " INSERT INTO project_tools (id,tool) ";
    $sql .= " VALUES ('$incident_id','$tools') ";

 

    $sql  = " INSERT INTO project_tools (id,tool) ";
    $sql .= " VALUES ('$incident_id','" . stripslashes($tools) . "') ";

 

 

    $sql  = " INSERT INTO project_tools (id,tool) ";
    $sql .= " VALUES ('$incident_id','" . mysql_real_excape_string($tools) . "') ";

Link to comment
https://forums.phpfreaks.com/topic/49366-apostrophe-breaking-mysql-query/
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.