<code>$info=M("qq")->where('name like','$name%')->select();</code>where里面是不是写的不对?给如下的错误提示:1064:you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near ')' at line 1 [ sql语句 ] : select * from qq where ( name like )
如果按百度出来的like的例子username like 'Admin%' 这样写的话
$info=M("qq")->where(name like '$name%')->select();
也是会报错:syntax error, unexpected 'like' (T_STRING)
<code>$info=M("qq")->where('name like','$name%')->select();</code>where里面是不是写的不对?给如下的错误提示:1064:you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near ')' at line 1 [ sql语句 ] : select * from qq where ( name like )
如果按百度出来的like的例子username like 'Admin%' 这样写的话
$info=M("qq")->where(name like '$name%')->select();
也是会报错:syntax error, unexpected 'like' (T_STRING)
<code>$info=M("qq")->where("name like '%s'",array($name))->select();</code>有时间可以看下 where方法的源码 或 看下pdo参数绑定 会有很大帮助
<code>//试试用这段代码:
M('qq')->where(['name'=>['LIKE',"$name%"])->select();</code>见tp文档:http://www.kancloud.cn/manual/thinkphp/1768
不谢。
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号