I made a login registration little thing myself, but once I log in with a letter, an error is reported first. the code is the login Action code under the controller // login submit controller & nbsp; & nbsp; public & nbsp; function & nbsp; logAction () & I made a small login registration item, but once I log in with a letter, an error is reported.
Code First
This is the login Action code under the controller.
// Log in and submit the controller
Public function logAction ()
{
// Obtain the login form parameters
$ Userid = $ this-> getRequest ()-> getParam ('userid ');
$ Password = $ this-> getRequest ()-> getParam ('psd ');
// Create a table model and query the logon password
$ Table = new user ();
$ Where = 'userid = '. $ userid;
$ Row = $ table-> fetchRow ($ where)-> toArray ();
// Verify the form password and database password
If ($ row ['password'] = $ password)
{
// Create a global variable session username id
Session_start ();
$ _ SESSION ['userid'] = $ userid;
// View of successful login
$ This-> render ('logok ');
}
Else
{
// Logon failure view displayed due to incorrect password
$ This-> render ('logfailed ');
}
}
This is the user table.
+ -------- + ---------- +
| Userid | username | password |
+ -------- + ---------- +
| 010 | messi | 010 |
| Robin | test | robin |
+ -------- + ---------- +
First, the registration process is normal. both records can be inserted normally.
However, it is normal to log on with the first record at 010 during login.
An error occurred while logging in with the second record robin !! Error 500: An error occurred Application error
However, if I enter a username and submit a form with a letter, the system will report an error without letters and numbers, but will not report any jump information.
First, I analyzed the reason why there was no jump when I wrote the username and password at will, because the returned value of fetchRow is null.
But why do I report an error once I write an English character ??
There should be no problem in getting form parameters. The Table model should be okay.
Page character set mysql character set zend studio character set is also unified to UTF-8
Is the $ where condition written incorrectly? but it is successfully redirected by using a number to log on.
Why is there such a strange problem?
I also tested the 010_010 character string that does not contain any special characters. The Error 500 is returned after the string is submitted.
This is really a strange issue .. share it:
------ Solution --------------------