PHP MySQL Connect to a Database
Before we can access data in a database, we need to create a connection to the database.
In PHP, this is done with the mysql_connect() function.
Syntax
mysql_connect(servername,username,password);
Example:
In the following example we store the connection in a variable ($con) for later use in the script. The "die" part will be executed if the connection fails:
Closing a Connection


No comments:
Post a Comment