php连接mysql,oracle,mssql数据库连接代码_PHP教程
程序员文章站
2022-03-07 14:09:54
...
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");
上一篇: PHP获取php,mysql,apche的版本信息示例代码_PHP教程
下一篇: css中什么是行高