Sunday, March 13, 2011

MySQL Connection


<?php
// we connect to example.com and port 3307
$link = mysql_connect('example.com:3307', 'mysql_user', 'mysql_password') or  die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>


<?php
// Make a MySQL Connection
mysql_connect("localhost", "example", "example123") or die(mysql_error());
mysql_select_db("my_db") or die(mysql_error());
echo 'Connected successfully';
?>

No comments:

Post a Comment