$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/11/15 15:50:25
$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;