php连接mysql,oracle,mssql数据库连接代码_PHP教程
程序员文章站
2022-03-23 15:27:50
...
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数组操作方法有哪些
下一篇: C语言实现删除数组中某个元素