A problem occurred while executing the index.php file, the database is already established.
Error message:
Warning:mysqli::mysqli () [Mysqli.mysqli]: (hy000/2003): Can ' t connect to MySQL server on ' localhost ' (10061) in D:\apmxe\ Htdocs\28\db_fns.php on line 5
Warning:mysqli::query () [Mysqli.query]: couldn ' t fetch mysqli in D:\apmxe\htdocs\28\index.php on line 8
Fatal Error:call to a member function Fetch_assoc () on a non-object in D:\apmxe\htdocs\28\index.php on line 12
Development environment: APM Express
May I ask how these problems can be solved?
Add: index.php Connection Database Part code
$handle = Db_connect (); $pages _sql = ' SELECT * from pages order by code '; $pages _result = $handle->query ($pages _sql); Echo '
'; while ($pages = $pages _result->fetch_assoc ()) {$story _sql = ' SELECT * from stories where page = ' {$pages [' Code '} ' and published is not NULL for ORDER by published Desc "; $story _result = $handle->query ($story _sql); if ($story _result->num_rows) {$story = $story _result->fetch_assoc (); echo "
{$pages [' description ']} {$story [' headline ']} Read more {$pages [' Code ']} ... |
";/*db_connect function function */function db_connect () { $handle = new mysqli (' localhost ', ' content ', ' password ', ' content '); if (! $handle) { return false; } return $handle;} Reply content: A problem occurred while executing the index.php file, the database is already established. Error message: Warning:mysqli::mysqli () [Mysqli.mysqli]: (hy000/2003): Can ' t connect to MySQL server on ' localhost ' (10061) in D:\apmxe\ Htdocs\28\db_fns.php on line 5 Warning:mysqli::query () [Mysqli.query]: couldn ' t fetch mysqli in D:\apmxe\htdocs\28\index.php on line 8 Fatal Error:call to a member function Fetch_assoc () on a non-object in D:\apmxe\htdocs\28\index.php on line 12 Development environment: APM Express May I ask how these problems can be solved? Add: index.php Connection Database Part code $handle = Db_connect (); $pages _sql = ' SELECT * from pages order by code '; $pages _result = $handle->query ($pages _sql); Echo '
'; while ($pages = $pages _result->fetch_assoc ()) {$story _sql = ' SELECT * from stories where page = ' {$pages [' Code '} ' and published is not NULL for ORDER by published Desc "; $story _result = $handle->query ($story _sql); if ($story _result->num_rows) {$story = $story _result->fetch_assoc (); echo "
{$pages [' description ']} {$story [' headline ']} Read more {$pages [' Code ']} ... |
/*db_connect function function */function db_connect () {$handle = new mysqli (' localhost ', ' Content ', ' password ', ' content '); if (! $handle) {return false; } return $handle;} Mysqli The password of the link, the account is all right???? First confirm that when you construct the mysqli object, all parameters are correct, and the four parameters are the database address, user name, password, and database name . Where the database user name and password, you want to confirm whether the fill is correct. Then confirm that your database is started (many people do forget). At the command line, enter telnet localhost 3306 To see if you can connect |
|