Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php connect ms sql server


<?php
$serverName = "serverNamesqlexpress"; //serverNameinstanceName

// Since UID and PWD are not specified in the $connectionInfo array,
// The connection will be attempted using Windows Authentication.
$connectionInfo = array( "Database"=>"dbName");
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {
     echo "Connection established.<br />";
}else{
     echo "Connection could not be established.<br />";
     die( print_r( sqlsrv_errors(), true));
}
?>

Source by www.php.net #
 
PREVIOUS NEXT
Tagged: #php #connect #ms #sql #server
ADD COMMENT
Topic
Name
2+3 =