Reputation:
I am using this code to log in to sql server express 2012
<?php
$serverName = "SD-20120627VVKE\SQLEXPRESS";
$connectionOptions = array("Database"=>"android_api");
$conn = sqlsrv_connect( $serverName, $connectionOptions);
if( $conn === false )
{ die( FormatErrors( sqlsrv_errors() ) ); }
?>
but I get this screen
How should I solve it?
Upvotes: 2
Views: 2208
Reputation: 18525
Try this:
<?php
$server = "SD-20120627VVKE\\SQLEXPRESS";
$options = array( "UID" => "<username>", "PWD" => "<password>", "Database" => "android_api");
$conn = sqlsrv_connect($server, $options);
if ($conn === false) die("<pre>".print_r(sqlsrv_errors(), true));
echo "Successfully connected!";
sqlsrv_close($conn);
?>
Upvotes: 1