• At my author page I run 2 MySQL queryies: one to get the quantity of published posts of the author and another to get all authors posts (to count the quantity of posts with attachments later).

    The queries are:

    1. $pcount=$wpdb->query(“select count(*) from wp_posts where ID='”.$curauth->ID.”‘ AND post_type=’post’;”);

    2. $posts = $wpdb->query (“select * from wp_posts where ID='”.$curauth->ID.”‘ AND post_type=’post’;”);

    I think, I made some mistakes in these queries, because first returns “1” and second returns “0” (I know it since I made “echo $pcount.’ ‘.$posts;”) instead of supposed result (I checked 2 different users with posts and attachments).

    Can you please show me my mistakes?

  • The topic ‘Error in query?’ is closed to new replies.