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...
|