<?php
$con = mysql_connect('localhost', 'root', 'password');
if (!$con) {
die('Not connected : ' . mysql_error());
}// make anant the current db
$db_selected = mysql_select_db('anant', $link);
if (!$db_selected) {
die ('Can\'t use anant database : ' . mysql_error());
}?>
Explanation :
step 1 : mysql_connect() is used to open a connection to a my sql
step 2 : mysql_select_db() is used to connect with database of mysql
$con = mysql_connect('localhost', 'root', 'password');
if (!$con) {
die('Not connected : ' . mysql_error());
}// make anant the current db
$db_selected = mysql_select_db('anant', $link);
if (!$db_selected) {
die ('Can\'t use anant database : ' . mysql_error());
}?>
Explanation :
step 1 : mysql_connect() is used to open a connection to a my sql
step 2 : mysql_select_db() is used to connect with database of mysql
No comments :
Post a Comment