Complete PHP MySQL Reference
The mysql_connect() function opens a non-persistent MySQL connection.
This function returns the connection on success, or FALSE and an error on failure. You can hide the error output by adding an '@' in front of the function name.
| Parameter | Description |
|---|---|
| server | Optional. Specifies the server to connect to (can also include a port number. e.g. "hostname:port" or a path to a local socket for the localhost). Default value is "localhost:3306" |
| user | Optional. Specifies the username to log in with. Default value is the name of the user that owns the server process |
| pwd | Optional. Specifies the password to log in with. Default is "" |
| newlink | Optional. If a second call is made to mysql_connect() with the same arguments, no new connection will be established; instead, the identifier of the already opened connection will be returned |
| clientflag | Optional. Can be a combination of the following constants:
|
Tip: The connection will be closed as soon as the script ends. To close the connection before, use mysql_close().
Tip: To establish a persistent MySQL connection, use mysql_pconnect() instead.
Complete PHP MySQL Reference
| WEB HOSTING |
|---|
| Best Web Hosting |
| PHP MySQL Hosting |
| Best Hosting Coupons |
| UK Reseller Hosting |
| Cloud Hosting |
| Top Web Hosting |
| $7.95/mo SEO Hosting |
| Premium Website Design |
| WEB BUILDING |
|---|
| XML Editor - Free Trial! |
| FREE Website BUILDER |
| Free Website Templates Free CSS Templates |
| Make Your Own Website |
| W3SCHOOLS EXAMS |
|---|
|
Get Certified in: HTML, CSS, JavaScript, XML, PHP, and ASP |
| W3SCHOOLS BOOKS |
|---|
|
New Books: HTML, CSS JavaScript, and Ajax |
| STATISTICS |
|---|
|
Browser Statistics Browser OS Browser Display |
| SHARE THIS PAGE |
|---|