WordPress.org

Ready to get started?Download WordPress

Forums

recemet comments SQL (1 post)

  1. Rami Yushuvaev
    Member
    Posted 5 years ago #

    when i try:

    $request = "SELECT ID, comment_ID, comment_content, comment_author, comment_author_url, post_title
    FROM
    $wpdb->comments AS cm,
    $wpdb->posts AS ps
    WHERE
    ps.ID=cm.comment_post_ID
    AND
    post_status IN ('publish','static') ";

    every thing is ok. but when i want to get the "user_login" from the wp_users table using this code:

    $request = "SELECT ID, comment_ID, comment_content, comment_author, comment_author_url, post_title, user_login
    FROM
    $wpdb->comments AS cm,
    $wpdb->posts AS ps,
    $wpdb->users AS us
    WHERE
    ps.ID=cm.comment_post_ID
    AND
    us.ID=cm.user_id
    AND
    post_status IN ('publish','static') ";

    the sql find no results. what am i doing wrong?

Topic Closed

This topic has been closed to new replies.

About this Topic