问题描述
这是我的示例代码,下面的代码显示当我使用该代码时看起来像管理员的所有产品。谁能给我一些时间来调试此问题?预先谢谢你
公共函数fetchcategory($ name){
$this->string = "SELECT disTINCT u.ID,p.ID,p.post_status,p.guid,p.post_title,t.name AS product_category,t.term_id AS product_id,t.slug AS product_slug
FROM wp_posts AS p
LEFT JOIN wp_postMeta pm1 ON pm1.post_id = p.ID
LEFT JOIN wp_term_relationships AS tr ON tr.object_id = p.ID
JOIN wp_term_taxonomy AS tt ON tt.taxonomy = 'product_cat' AND tt.term_taxonomy_id = tr.term_taxonomy_id
JOIN wp_terms AS t ON t.term_id = tt.term_id
JOIN wp_users AS u ON p.post_author=u.ID
WHERE pm1.post_id = p.ID
AND p.post_author= u.ID
AND t.name = '$name'";
$info=[];
if($result=$this->db->query($this->string)){
while($rows = $result->fetch_assoc()){
array_push($info,$rows);
}
json_encode($info);
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)