这样写数据库为什么会查询出错?
2016-07-07 15:38 来源:www.chinab4c.com 作者:ecshop专家
为了能让首页显示商品的品牌,所以在 includes/lib_goods.php的288行的查询语句,添加了查询brand表但不知道怎么了就出问题了 高手能帮忙看下吗? $sql = 'SELECT g.goods_id,g.goods_sn, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price,b.brand_name ' . "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ". "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, RAND() AS rnd " . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b '. "on g.brand_id = b.brand_id " . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ". "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]'"; $type_merge = array_merge($type_array['new'], $type_array['best'], $type_array['hot']); $type_merge = array_unique($type_merge); $sql .= ' WHERE g.goods_id ' . db_create_in($type_merge); $sql .= ' ORDER BY g.sort_order, g.last_update DESC'; |
回答:
帮顶了…… |
建议换成双引号! |
最近更新
常用插件
- ecshop后台订单商品列表查
ecshop后台订单商品列表查询插件,可以通过名称。就把产品显示检索出...
- ecshop评论功能改进插件
ecshop评论功能改进插件,这个插件是改进了现有的ecshop评论功能的一些...
- ecshop商品列表中品牌批量
ecshop商品列表中品牌批量转移插件.这个插件听起来非常希奇。但是我们...
- ecshop2.7.2迷你购物车插件
ecshop2.7.2迷你购物车插件,这个插件主要是针对修改ecshop购买功能,为了...
- ecshop导出待发货订单exce
ecshop导出待发货订单excel格式,这个东西是十分重要的,我们在倒出ec...
ecshop热门问答
ecshop热门资料
ecshopCOCO
ecshopChat
ecshop收货人
ecshop浮水印
ecshop谷歌分析
ecshop转跳
ecshopmanual
ecshop商品字段
ecshop工商
ecshoplamiu
ecshop搜索结果
ecshop毕??
ecshop创建
ecshop时好时坏
ecshop路劲问题
ecshop科技创业
ecshop热销商品
ecshop为什么
ecshophelp
ecshopSpyder
ecshop1103
ecshopCommodity
ecshopbuy
ecshop如何
ecshop2.7.2
ecshop浮动广告
ecshop容文字
ecshop合作
ecshop数据出错
ecshop前辈