Opening a Connection and Selecting a Database : MySQL Connection : MySQL Database PHP Source Code


PHP Source Code » MySQL Database » MySQL Connection »

 

Opening a Connection and Selecting a Database



<html>
<head>
<title>Opening a connection and selecting a database</title>
</head>
<body>
<?php
$user = "navioo";
$pass = "password";
$db = "navioo";
$link =  mysql_connect"mysql153.secureserver.net", $user, $pass );

if ! $link ){
     die"Couldn't connect to MySQL" );
}
print "Successfully connected to server<P>";
mysql_select_db$db or die "Couldn't open $db: ".mysql_error() );
print "Successfully selected database "$db"<P>";
mysql_close$link );
?>
</body>
</html>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo MySQL Database
» MySQL Connection