The where condition of thinkphp cannot use an array. if I write the analysis result like this, I can query the data: $ admin_data = $ admin-> where ('username = "'. $ username. '"')-> find ();
In this case, the webpage "cannot display this webpage": $ admin_data = $ admin-> where (array ('username' => $ username)-> find ();
Analyze the cause.
1. the thinkphp version is 3.13.
2. it is the testing code, regardless of other code interference.
Reply to discussion (solution)
PHP: 5.2
I uninstalled IIS on the machine a few days ago.
$ Arr ['username'] => $ username;
$ Admin_data = $ admin-> where ($ arr)-> find ();
Try
$ Arr ['username'] = $ username;
$ Admin_data = $ admin-> where ($ arr)-> find ();
Try
$ Ar = "username = 'yourname '";
Echo is_array ($ ar );
The first input is not an array, but a string.
$ Arr ['username'] = $ username;
$ Admin_data = $ admin-> where ($ arr)-> find ();
Try
Or not.
The first input is not an array, but a string.
Maybe I didn't express it clearly. I mean, in the where clause, it is normal to query in the string form. in the array form, "this webpage cannot be displayed"
Let's take a look at the parameters received in the find () method ??
What is the type of the username field?
Check the thinkPHP running record to see what is wrong, or manually enter a new php file. Some errors are terrible,
$ Admin_data = $ admin-> query ("select * from hao_admin ");
$ Admin_data = $ admin-> where (array ('username' => $ username)-> find ();
The first type of query is normal with data.
The second type of query is "this page cannot be displayed ".
View apache error logs:
PHP Warning: Directive 'register _ globals' is no longer supported in PHP 6 and greater in Unknown on line 0
PHP Warning: Directive 'register _ long_arrays 'is no longer supported in PHP 6 and greater in Unknown on line 0
PHP Warning: Directive 'Magic _ quotes_gpc 'is no longer supported in PHP 6 and greater in Unknown on line 0
I have read logs before, but I don't pay too much attention to these errors.
The PHP version is PHP6.0.0 through phpinfo. After PHP5.2.6 is reinstalled, OK.
Is there such a thing?