How to display statements executed by thinkphp
The control area is written like this.
function Checklogin () {
$condition [' employeeno '] = $_request[' Employeeno ');
$condition [' password '] = $_request[' password ');
$model = M ("EmployeeInfo");
SQL ($model);
if ($results) {
if (Trim ($results [0][' Password ') = = = $condition [' Password ']) {
echo "{success:true,msg: ' OK '}";
Session::set (' Employeeno ', ' Employeeno ');
Session::set (' UserInfo ', $results [0]);
Return
}
}
echo "{success:true,msg: ' login account no mutual or password error! '}";
}
I logged in 38 times, did not succeed (prompt login account does not have mutual or password error), log also did not prompt the error.
To help me check the data, I'm going to put SQL statements, printers out, such as: Select Employeeno,password from
I use VAMP ($model)
Also not show up.
------Solution--------------------
Turn on debug, check SQL statements, copy SQL statements in the database to see if there are any results
------Solution--------------------
$model = M ("EmployeeInfo");
$results = $model->where ($condition)->select ();
echo $results->getlastsql ();
------Solution--------------------
Plus
$condition [' _logic '] = ' and ';
$model = M ("EmployeeInfo");
$results = $model->where ($condition)->select ();
$model->getlastsql ();
Look at that.