PHP connection Mysql,oracle,mssql Database Connection Code _php tutorial

Source: Internet
Author: User
Tags mysql tutorial
PHP connection Mysql,oracle,mssql Database Connection code

PHP Tutorial Connection MySQL tutorial, oracle,mssql database Tutorial Connection code
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 ("Database Server connection Error". Mysql_error ());
mysql_select_db ("admin", $conn) or Die ("Database access Error". Mysql_error ());
mysql_query ("Set names gb2312");

http://www.bkjia.com/PHPjc/630843.html www.bkjia.com true http://www.bkjia.com/PHPjc/630843.html techarticle PHP Connection mysql,oracle,mssql database Connection code PHP tutorial Connection mysql tutorial, oracle,mssql database Tutorial Connection code//mssql $server = ' HBDS3 '; $username = ' Username '; $password = ' pwd '; $...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.