• I found every time when the inserted text contained something like
    “we’re you’re it’s they’re”, the data didn’t show up in mysql table. The php file went through without problem. But where’s my stored data :-)? ANy idea? Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • How are you instering that data?

    You should be using WordPress’s $wpdb object as this will take are of all of the escaping that’s needed for any strings like this. As an example…

    $wpdb->insert ($wpdb->prefix."table_name", array (
        "col_1" => "Let's add in this line"
    );

    Just as a note, you’re getting that problem because MySQL takes single-quotes as string delimiters, so if you want to add a single-quote into a text column you need to escape it with a backslash, like:

    INSERT INTO table_name (col_1) VALUES ('Let\'s add in this line!');

    Thread Starter hh2015

    (@hh2015)

    Hey catacaustic, thank you very much this is very helpful :-)!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to insert "we're it's you're" into a mysql table’ is closed to new replies.