Home > Backend Development > PHP Tutorial > SQL语法急求解决方案

SQL语法急求解决方案

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:26:09
Original
813 people have browsed it

SQL语法急求
SELECT `id`,`linkurl` FROM `users` WHERE `id` NOT IN('143,137,137,153,88,3') AND `able`='yes' ORDER BY `jifen` DESC LIMIT 1这样写法对吗

怎么把变量
$value=143,137,137,153,88,3';传入到
SELECT `id`,`linkurl` FROM `users` WHERE `id` NOT IN('$value') AND `able`='yes' ORDER BY `jifen` DESC LIMIT 1

------解决方案--------------------
若 id 是字符型的或一定要加单引号的话,$value 需加工一下
$value = '143,137,137,153,88,3';
$value = str_replace(',', "','", $value);

... `id` NOT IN('{$value}') ...

Related labels:
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