I'm trying to connect from php to Azure DB by
$connectionInfo = array("UID" => "xxx@xxx", "pwd" => "xxx", "Database" => "xxx");
$serverName = "tcp:xxx.database.windows.net,1433";
$conn = sqlsrv_connect($serverName, $connectionInfo);
But it gives me
Fatal error: Call to undefined function sqlsrv_connect() in C:\wamp\www...\index.php on line 19
you have to use the SQL Server native driver for php at first place, then you can do something like:
$serverName = "tcp:sample.database.windows.net, 1433";
$connectionOptions = array("Database" => "sampleInit",
"UID" => "sampleUsr@sample",
"PWD" => "samplePass",
"MultipleActiveResultSets" => false);
$conn = sqlsrv_connect($serverName, $connectionOptions);
if($conn === false)
{
die(print_r(sqlsrv_errors(), true));
}
You can read more on PHP and SQL Azure at following blog post:
http://blogs.msdn.com/b/brian_swan/archive/2010/02/12/getting-started-with-php-and-sql-azure.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With