Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other SQL Like Statement in WordPress

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #34002

    i wrote following sql statement in mySQL and i got the answers i wanted without problems. but i wrote that in wordpress but no answers! i goggled and found out that you should use “like_escape()” in wordpress to for using “Like” SQL Statement! but the problem is i dont know how! here is my SQL that doesn’t work in wordpress:

    "SELECT COUNT(post_author) FROM wp_posts WHERE post_title NOT LIKE 'Reply To:%' "

    any help will be appreciate.

    #122914
    TylerNYC
    Member

    It would look similar to this.

    $wpdb->prepare( “SELECT COUNT(post_author) from wp_posts WHERE post_title NOT LIKE %s;”, ‘%’ . like_escape($ReplyTo) . ‘%’);

    #122915

    thanks @TylerNYC but i doesn’t work :(

    #122916

    @TylerNYC i tried again your code and YEEES it Works! :) thanks @TylerNYC

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Other’ is closed to new topics and replies.