-
Open a Connection to the MySQL Server
Store the connection in a variable ($con) for later use in the script:
<?php
// Create connection
$con = mysql_connect("dbhost", "dbuser ", "dbpass ", "dbname");
// Check connection
if (mysql_connect_error())
{
echo "Failed to connect to MySQL: " . mysql_connect_error();
}
?>
Last edited by minisoji; 02-14-2014 at 07:39 AM.
-
Close a Connection
<?php
$con = mysql_connect("dbhost", "dbuser ", "dbpass ", "dbname");
// Check connection
if (mysql_connect_error())
{
echo "Failed to connect to MySQL: " . mysql_connect_error();
}
mysql_close($con);
?>
Last edited by minisoji; 02-14-2014 at 07:30 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks