How to Create a CMS system in php and mysqlweb development (the third edition of the original book?

Source: Internet
Author: User
Tags apm
An error occurred while executing the index. php file. The database has been created. Error message: Warning: mysqli () [mysqli. mysqli] :( HY0002003): Can & #039; tconnecttoMySQLserveron & #039; localhost & #039; (10061) inD: apmxehtdocs28db_fns ....

An error occurred while executing the index. php file. The database has been created.
Error message:

Warning: 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

How can we solve these problems?

Supplement: some code for connecting index. php to the database

$ 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 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 db_connect () {$ handle = new mysqli ('localhost', 'content', 'Password', 'content'); if (! $ Handle) {return false;} return $ handle ;}

Reply content:

An error occurred while executing the index. php file. The database has been created.
Error message:

Warning: 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

How can we solve these problems?

Supplement: some code for connecting index. php to the database

$ 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 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 db_connect () {$ handle = new mysqli ('localhost', 'content', 'Password', 'content'); if (! $ Handle) {return false;} return $ handle ;}

Is the password of the mysqli link correct to all accounts ????

First confirm your constructionmysqliAll the parameters are correct, and the four parameters areDatabase address, user name, password, Database Name. Check whether the database username and password are correct.

Then confirm whether your database is started (many people forget it ). Enter

telnet localhost 3306

Check whether it can be connected.

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.