나는 phpMyAdmin에이를 실행 한 :계수 결과
SELECT user_id, DATE(comment_date) comment_date,
COUNT(*) comment_ID
FROM wp_comments
WHERE user_id='3'
GROUP BY user_id, DATE(comment_date) ;
를 나에게 사 개 결과를 보여 주지만 때 PHP에서이 다른 시뮬레이션, 샘플 3 개 결과 :
global $current_user, $wpdb;
$count = $wpdb->get_var("SELECT user_id, DATE(comment_date) comment_date,
COUNT(*) comment_ID FROM ".$wpdb->comments.
" WHERE user_id='".$current_user->ID."'
GROUP BY user_id, DATE(comment_date) ;");
echo $count;
echo "SELECT user_id, DATE(comment_date) comment_date, COUNT(*) comment_ID
FROM ".$wpdb->comments."
WHERE user_id='".$current_user->ID."'
GROUP BY user_id, DATE(comment_date) ;";
표시 :
당신은 PHP에서 쿼리를 실행하면SELECT user_id, DATE (comment_date) comment_date, COUNT (*) comment_ID FROM wp_comments WHERE user_id = '3'GROUP BY user_id, DATE (comment_date);
$ current_user-> id를 echo하고 쿼리가 실제로 사용하고 있는지 확인하십시오. – ElendilTheTall
여러분의 주석 변수가 올바른지 확인하기 위해 전체 SQL 명령을 실제로 표시합니다. –
예, $ current_user-> ID는 3이고 $ wpdb-> comments는 wp_comments입니다. 나는 확인했다. 나는 다른 사용자와 시도해 보았는데 기대했던 결과를주지 못했다. – jon90