Php connection to mysql, oracle, and mssql database connection code

Source: Internet
Author: User
The php connection mssql code is as follows: $ server #39; hbds3 #39; $ username #39; username #39; nbs... php connection mssql code is as follows:

$ 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 ");

The php code for connecting to oracle is as follows:

$ Conn = oci_connect ("databasename", "passwd", "sid"); if (! $ Conn) {$ e = oci_error (); trigger_error (htmlentities ($ e ['message'], ent_quotes), e_user_error );}

Php connects to mysql with the following code:

$ 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 (); // open-source code phprm.com mysql_query ("set names gb2312 ");


Address:

Reprinted at will, but please attach the article address :-)

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.