Build Your Own DatabaseDriven Website Using PHP amp;amp; MySQL [Electronic resources]

Kevin Yank

نسخه متنی -صفحه : 190/ 133
نمايش فراداده

mysql_connect

mysql_connect([hostname[:port|:/socket/path][, username[, password]]])

This function opens a connection to a MySQL server and returns a connection ID (which evaluates to true) that may be used in other MySQL-related functions. The following default values are assumed if they are not specified:

hostname:port

'localhost:3306'

username

server process name

password

''

If the connection attempt is unsuccessful, an error message will be displayed by default and the function will return false. To bypass display of the error message (e.g. to display your own by checking the return value), put '@' at the start of the function name (i.e. @mysql_connect(...)).