$n=M("Nav"); $name=$n->where(array('id'=>4))->find(); echo $n->getLastSql();
The result of the output is:
SELECT * FROM `aa_nav` LIMIT 1
Why is the Where condition gone?
When I do not use an array in the Where condition, and the string is not a problem.
Reply content:
$n=M("Nav"); $name=$n->where(array('id'=>4))->find(); echo $n->getLastSql();
The result of the output is:
SELECT * FROM `aa_nav` LIMIT 1
Why is the Where condition gone?
When I do not use an array in the Where condition, and the string is not a problem.
Thinkphp 3.2.3 says everything is OK, you can use array
Not sure if it is a version issue, 3.x version will not have this problem.
['id']=4
It should be ok
Confirm that there is an ID in this field?
The problem is solved, explain the specific situation:
1. The table built with the Mysql-front tool, by default, has a self-increment column named "id" instead of "id";
2. When using the thinkphp where condition, if it is in the form of a string, it should be case-insensitive, so I put the ID as an ID is also possible, but with the formation of the array is case-sensitive, the case of the wrong size will be a problem.
In addition, thank you for your reply.