在前台商品列表,我怎么再加一些条件

2016-07-07 15:05 来源:www.chinab4c.com 作者:ecshop专家

$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' .
"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, g.promote_price, g.goods_type, " .
'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' .
'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .
'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' .
"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' " .
"WHERE g.goods_name = 夏新T5 AND $where $ext $eee ORDER BY $sort $order";

请教一下,在前台商品列表,我怎么再加一些条件,例如,我只显示商品名称为 夏新T5"WHERE g.goods_name = 夏新T5 AND $where $ext $eee ORDER BY $sort $order"; 加了没反应

回答:
至少你要加成g.goods_name = ‘夏新T5’
按你的写法一定会有反应的
mysql报错的。。

谢谢,你提示,但还是没用,代码有错嘛

"WHERE g.goods_name = '$username' AND $where $ext ORDER BY $sort $order";
'$username' 没法取当前登陆的用户名, {$username} 请教一下怎么弄,



你在后台清除缓存,应该就会报了

非常感谢楼上两位好人,精彩回答,问题解决了,