• Hello,

    I have a problem with $wpdb->get_var if there is an apostrophe in variable,
    for example:

    $wp_posts = $wpdb->get_var( “SELECT ID FROM wp_posts WHERE post_title =’$where’ ” );

    echo $wp_posts;

    1) if $where = “my text”;
    ——> IT OK; print the ID

    2) if $where = “I’ll give you back”;
    ——> DOESN’T WORK; doesn’t print the ID

    How can I fix it?
    Thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘$wpdb->get_var and apostrophe’ is closed to new replies.