Help inserting quote in Mysql table

by 1 replies
1
I am trying to insert text with a quote in the mysql table using php form. I am getting error as i am using insert into query with single quotes too.

How to do it?
#programming #inserting #mysql #table
  • Your quotes should be backslashed \"Quoted Text\"

    Then when it is out putted to what ever script you remove the backslashes.

    $str = '"Test Quote"';
    echo $str . '<br />';

    $input = addslashes($str);
    echo $input . '<br />';

    $output = stripslashes($input);
    echo $output;

    NOTE: that does not make your form secure and is still open to SQL injection and other vulnerabilities.

Next Topics on Trending Feed