본문 바로가기

프로그램 경험/PHP

[PHP] MsSql 연동 모듈(Sqlsrv) 연결 테스트

<?php

/* Specify the server and connection string attributes. */

$serverName = "localhost";


/* Get UID and PWD from application-specific files.  */

$uid ="sa";

$pwd = "1234";

$connectionInfo = array( "UID"=>$uid,

    "PWD"=>$pwd,

    "Database"=>"temp_db");


/* Connect using SQL Server Authentication. */

$conn = sqlsrv_connect( $serverName, $connectionInfo);


if( $conn === false )

{

    echo "Unable to connect.</br>";

    die( print_r( sqlsrv_errors(), true));

}

else

{

    echo "connect!!!!!!!!.</br>";

}