How to display thinkphp executed statements

Source: Internet
Author: User
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.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.