sql :
select p.id , c.comment_author , p.post_title ,p.guid , c.comment_date from wp_comments c left join wp_posts p on c.comment_post_ID = p.ID and c.comment_approved= 1 order by c.comment_date desc limit 0 , 5代码:$result = mysql_fetch_array($query);异常:Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in
select p.id , c.comment_author , p.post_title ,p.guid , c.comment_date from wp_comments c left join wp_posts p on c.comment_post_ID = p.ID and c.comment_approved= 1 order by c.comment_date desc limit 0 , 5代码:$result = mysql_fetch_array($query);异常:Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in
query()方法再用mysql_fetch_array()方法
再不行,你就记录你的sql语句,到数据库中取执行看是否成功
select p.id , c.comment_author , p.post_title ,p.guid , c.comment_date from wp_comments c left join wp_posts p on c.comment_post_ID = p.ID where c.comment_approved= 1 order by c.comment_date desc limit 0 , 5
FROM wp_comments c
LEFT JOIN wp_posts p ON c.comment_post_ID = p.id
WHERE c.comment_approved= 1
ORDER BY c.comment_date desc
limit 0 , 5