$sql_notice = "select * from $t_article art inner join $t_article_cat cat where art.cat_id=cat.cat_id and cat.cat_id='$ncat_id' and cat.is_show=1 and art.is_show=1 order by art.short_order desc limit 0,10";这句代码哪里错了,为什么降序实
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/27 13:58:02
![$sql_notice =](/uploads/image/z/12320361-9-1.jpg?t=%24sql_notice+%3D+%22select+%2A+from+%24t_article+art+inner+join+%24t_article_cat+cat+where+art.cat_id%3Dcat.cat_id+and+cat.cat_id%3D%27%24ncat_id%27+and+cat.is_show%3D1+and+art.is_show%3D1+order+by+art.short_order+desc+limit+0%2C10%22%3B%E8%BF%99%E5%8F%A5%E4%BB%A3%E7%A0%81%E5%93%AA%E9%87%8C%E9%94%99%E4%BA%86%2C%E4%B8%BA%E4%BB%80%E4%B9%88%E9%99%8D%E5%BA%8F%E5%AE%9E)
$sql_notice = "select * from $t_article art inner join $t_article_cat cat where art.cat_id=cat.cat_id and cat.cat_id='$ncat_id' and cat.is_show=1 and art.is_show=1 order by art.short_order desc limit 0,10";这句代码哪里错了,为什么降序实
$sql_notice = "select * from $t_article art inner join $t_article_cat cat where art.cat_id=cat.cat_id and cat.cat_id='$ncat_id' and cat.is_show=1 and art.is_show=1 order by art.short_order desc limit 0,10";
这句代码哪里错了,为什么降序实现不了?
$sql_cat = "select * from $t_article_cat where is_show=1 and shop_id='$shop_id' order by sort_order asc limit 0,1";
$cat_notice = $dbo->getRs($sql_cat);
foreach($cat_notice as $value){
$ncat_id=$value['cat_id'];
$sql_notice = "select * from $t_article art inner join $t_article_cat cat where art.cat_id=cat.cat_id and cat.cat_id='$ncat_id' and cat.is_show=1 and art.is_show=1 order by art.short_order desc limit 0,10";
$notice = $dbo->getRs($sql_notice);
$sql_notice = "select * from $t_article art inner join $t_article_cat cat where art.cat_id=cat.cat_id and cat.cat_id='$ncat_id' and cat.is_show=1 and art.is_show=1 order by art.short_order desc limit 0,10";这句代码哪里错了,为什么降序实
你没有设置连接关系 on art.cat_id=cat.cat_id ,修改如下
$sql_notice = "select art.* ,cat.* from ".$t_article." art inner join ".$t_article_cat." cat on art.cat_id=cat.cat_id where cat.cat_id='".$ncat_id."' and cat.is_show=1 and art.is_show=1 order by art.short_order desc limit 0,10";
echo $sql_notice;