Php connection to SQLSERVER

Source: Internet
Author: User
PHPcode $ host192.168.1.122; -- IP $ port1433; -- Port $ instanset02; -- instance name $ usernamesa; $ passwordpassss; if (! $ Linkmssql_connect ($ host. php connection to the instance name in the SQLSERVER connection string
PHP code
  $ Host = '2017. 168.1.122 '; -- IP $ port = 1433; -- port $ instanse = 't02'; -- instance name $ username = 'sa'; $ password = 'passs'; if (! $ Link = mssql_connect ($ host. ':'. $ port. $ instanse, $ username, $ password) -- It seems wrong


122 of SQLSERVER has multiple instances. I do not want to connect to the default instance, but want to connect to the T02 instance

In SSMS, the format is 192.168.1.122, 1433 \ t02.

Where is the instance name of SQLSERVER written? The writing method above is not acceptable


------ Solution --------------------
// Server in the this format: \ Or
// , When using a non default port number
$ Server = 'kallespc \ SQLEXPRESS ';

// Connect to MSSQL
$ Link = mssql_connect ($ server, 'sa ', 'phpfi ');

If (! $ Link ){
Die ('something wrong while connecting to mssql ');
}
?>

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.