<code>$info=M("qq")->where('name like','$name%')->select();</code>
Is it written incorrectly in where? Give the following error message: 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 statement]: SELECT * FROM qq
WHERE ( name like )
If you write the like example username like 'Admin%' from Baidu like this
$info=M("qq")->where(name like '$name%')->select( );
will also report an error: syntax error, unexpected 'like' (T_STRING)
<code>$info=M("qq")->where('name like','$name%')->select();</code>
Is it written incorrectly in where? Give the following error message: 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 statement]: SELECT * FROM qq
WHERE ( name like )
If you write the like example username like 'Admin%' from Baidu like this
$info=M("qq")->where(name like '$name%')->select( );
will also report an error: syntax error, unexpected 'like' (T_STRING)
<code>$info=M("qq")->where("name like '%s'",array($name))->select();</code>
If you have time, you can look at the source code of the where method or look at the pdo parameter binding, it will be of great help
<code>//试试用这段代码: M('qq')->where(['name'=>['LIKE',"$name%"])->select();</code>
See tp documentation: http://www.kancloud.cn/manual/thinkphp/1768
You’re welcome.