Help inserting quote in Mysql table

by seokid
1 replies
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?
#inserting #mysql #table
  • Profile picture of the author phpbbxpert
    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.
    {{ DiscussionBoard.errors[2970808].message }}

Trending Topics