Friday, April 13, 2007

PHP conection to Mysql database

as simple as eating chochobar.......

function mysql_dbconnect($server,$user,$pass,$db)
if (!
$link) {
'Not connected : ' . mysql_error());

// make foo the current db
$db_selected = mysql_select_db($db, $link);
if (!
$db_selected) {
die (
'Can\'t use database : ' . mysql_error());


Save above file as mysqlconnect.php you can use above function for the
any time establish mysql-php connection by including that file. and using
function you have to just call when you need


mysql_dbconnect('mysql serve rname','user of database','password for that user','database you wish to connect');

No comments: