$info=M("qq")->where('name like','$name%')->select();
Is there a wrong writing in the Where? The following error message is given: 1064:you has an error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-to-use (") ' at line 1 [SQL statement]: SELECT * from qq
WHERE (name)
If you follow the example of Baidu like username ' admin% '
$info =m ("QQ")->where (name like ' $name% ')->select ();
will also error: syntax error, unexpected ' like ' (t_string)
Reply content:
$info=M("qq")->where('name like','$name%')->select();
Is there a wrong writing in the Where? The following error message is given: 1064:you has an error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-to-use (") ' at line 1 [SQL statement]: SELECT * from qq
WHERE (name)
If you follow the example of Baidu like username ' admin% '
$info =m ("QQ")->where (name like ' $name% ')->select ();
will also error: syntax error, unexpected ' like ' (t_string)
$info=M("qq")->where("name like '%s'",array($name))->select();
There is time to look at the source of the Where method or look at the PDO parameter bindings will help a lot
//试试用这段代码:M('qq')->where(['name'=>['LIKE',"$name%"])->select();
See TP Document: http://www.kancloud.cn/manual/thinkphp/1768
Buxie.