php連接mysql,oracle,mssql數據庫連接代碼
php教程連接mysql教程,oracle,mssql數據庫教程連接代碼
//mssql
$server='hbds3';
$username='username';
$password='pwd';
$database='database';
$conn=mssql_connect($server,$username,$password)
or die("couldn't connect to sql server on $server");
$db=mssql_select_db($database) or die("couldn't open database $database");
//oracle
$conn = oci_connect("databasename","passwd","sid");
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ent_quotes), e_user_error);
}
//mysql
$conn=mysql_connect("localhost","root","admin") or die("數據庫服務器連接錯誤".mysql_error());
mysql_select_db("admin",$conn) or die("數據庫訪問錯誤".mysql_error());
mysql_query("set names gb2312");