PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

php中sql变量需要单引号的时候变量如何设置?

原创
2016-06-23 13:13:45 1347浏览

$coupons = pdo_fetchall("select * from ".tablename('wangniu_activity')." where flag = 0 and isopen = 1 and ischeck = 1 and start_time < ".time()." and end_time > ".time()." and weid = ".$weid." and storeid = '".$id."'. order by type asc");


其中sql执行为:
select * from `ims_wangniu_activity` where flag = 0 and isopen = 1 and ischeck = 1 and start_time  1458445852 and weid = 2 and storeid = 'B0FFF4YWV2' . order by type asc

多了一个点,这个点怎么去掉?


回复讨论(解决方案)

... " and storeid = '".$id."' order by type asc"

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。