Home > Backend Development > PHP Tutorial > php中sql变量需要单引号的时候变量如何设置?

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

WBOY
Release: 2016-06-23 13:13:45
Original
1595 people have browsed it

$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");
Copy after login


其中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"

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template