Fatalerror: Calltoamemberfunctionfetch_array () onanon-objectin62line

Source: Internet
Author: User
Fatalerror: Calltoamemberfunctionfetch_array () onanon-objectin62line If ($ _ POST [admin_user]! = "" | $ _ POST [admin_pass]! = "")
{
$ Conn = new mysqli ("localhost", "root", "db_wlgl );
$ Conn-> query ("set names gb2312 ");
$ Admin_user = $ _ POST [admin_user];
$ Admin_pass = ($ _ POST [admin_pass]);
$ SQL = $ conn-> query ("call admin_regs ('". $ admin_user. "', '". $ admin_pass ."')");
$ Res = $ SQL-> fetch_array (MYSQL_BOTH); // 62 rows
If ($ res! = NULL ){

Session_register ("admin_user ");
Session_register ("admin_pass ");
Echo "script alert ('Administrator logon successful! '); Window. location. href = 'indexs. php'; script ";
} Else {
Echo "script alert ('Administrator logon failed! '); Script ";
}
}

?>


Reply to discussion (solution)

Come to the gods, please solve it.

Echo $ conn-> error on line 62; check

$ SQL = $ conn-> query ("call admin_regs ('". $ admin_user. "', '". $ admin_pass ."')");
Execution failed
Echo $ conn-> error;
Look

Echo $ conn-> error on line 62; check



No database selected; it is impossible to select a database.

Echo $ conn-> error on line 62; check


No database selected; it is impossible to select a database.

This is the connection database file conn. php


$ Id = mysql_connect ("localhost", "root ");
Mysql_select_db ("db_wlgl", $ id );
Mysql_query ("set names gb2312 ");
?>

$conn = new mysqli("localhost", "root", "", "db_wlgl);

You didn't see include conn. php, but it is useless because you use mysqli.

$conn = new mysqli("localhost", "root", "", "db_wlgl);


My database does not have a password .. You don't need to fill it out.

You didn't see include conn. php, but it is useless because you use mysqli.


How can this problem be solved?

Isn't the big version on the 7th floor?

Yes? If this parameter is not specified, it is an empty string, but the position still needs to be occupied.

// Your $ conn = new mysqli ("localhost", "root", "db_wlgl); change to $ conn = new mysqli (" localhost "," root ","", "db_wlgl ");

// Your $ conn = new mysqli ("localhost", "root", "db_wlgl); change to $ conn = new mysqli (" localhost "," root ","", "db_wlgl ");



If you have tried it, the same error is still reported ..

Paste your modified code.

$ SQL = $ conn-> query ("call admin_regs ('". $ admin_user. "','". $ admin_pass. "')") or die ($ conn-> error );

Me too. for this solution, please instruct Fatal error: Call to a member function fetch_array () on a non-object in D: \ xampp \ htdocs \ wlgl \ index. php on line 62 $ res = $ SQL-> fetch_array (MYSQL_BOTH );

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.