"; ?>
echo "Intro: Let's do a little generic database work!
";
$user = "root";
$passwd = "";
// Connecting to and selecting a database
$connect = mysql_connect('localhost', $user, $passwd)
or die('Could not connect: ' . mysql_error());
echo 'Step 1: Connected successfully!
';
$db = 'samples';
mysql_select_db($db) or die('Could not select database ('.$db.') because of : '.mysql_error());
echo 'Step 2: Connected to ('.$db.') successful!
';
// Now we close the connection...
mysql_close($connect);
?>
No comments:
Post a Comment