PHP and MYSQL interactive function table learning NOTE _ PHP Tutorial

Source: Internet
Author: User
Notes for learning the interactive function table between PHP and MYSQL. Recently, I have been studying php (as the mainstream development language) and MySQL (the best combination with PHP). I feel that php (as the mainstream development language) working with MySQL (the best group with PHP) has recently been studying php (as the mainstream development language) and MySQL (the best combination with PHP ), I feel that the interaction between php (as the mainstream development language) and MySQL (the best combination with PHP) is procedural, and of course MySQL (the best combination with PHP) I extension, object-oriented, Java and C # write more, then write php (as the mainstream development language), some do not adapt, I feel back to the era of learning C. I learned some functions today and recorded them so that I can refer to them when I forget them later.

Description Letter count Detailed description Description
Establish database connection MySQL (best combination with PHP) _ connect () Resource MySQL (best combination with PHP) _ connect ([string hostname [: port] [:/path/to/socket] [, string username] [, string password])
Example: $ conn = @ MySQL (the best combination with PHP) _ connect ("localhost", "username", "password ") or dir ("cannot connect to MySQL (the best combination with PHP) Server ");
Close the connection that must be displayed when this connection is used
Establish database connection MySQL (best combination with PHP) _ pconnect () Resource MySQL (best combination with PHP) _ pconnect ([string hostname [: port] [:/path/to/socket] [, string username] [, string password])
Example: $ conn = @ MySQL (the best combination with PHP) _ pconnect ("localhost", "username", "password ") or dir ("cannot connect to MySQL (the best combination with PHP) Server ");
The connection function does not need to be displayed to close the connection. it is equivalent to using the connection pool.
Close database connection MySQL (best combination with PHP) _ close () $ Conn = @ MySQL (the best combination with PHP) _ connect ("localhost", "username", "password ") or die ("cannot connect to MySQL (the best combination with PHP) Server ");
@ MySQL (the best combination with PHP) _ select_db ("MyDatabase") or die ("This database cannot be selected, or the database does not exist ");
Echo "you have connected to MyDatabase ";
MySQL (the best combination with PHP) _ close ();
 
Select database MySQL (best combination with PHP) _ select_db () Boolean MySQL (best combination with PHP) _ select_db (string db_name [, resource link_id])
$ Conn = @ MySQL (the best combination with PHP) _ connect ("localhost", "username", "password ") or die ("cannot connect to MySQL (the best combination with PHP) Server ");
@ MySQL (the best combination with PHP) _ select_db ("MyDatabase") or die ("This database cannot be selected, or the database does not exist ");

Idea (as the mainstream development language) and MySQL (the best combination with PHP) feel that php (as the mainstream development language) and MySQL (the best group with PHP...

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.