After running my PHP Program I am getting the error as follows:
Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -49 [code] => -49 [2] => This extension requires the Microsoft ODBC Driver 11 for SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712 [message] => This extension requires the Microsoft ODBC Driver 11 for SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712 ) [1] => Array ( [0] => IM002 [SQLSTATE] => IM002 [1] => 0 [code] => 0 [2] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [message] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified ) )
I have installed all extension and enabled in PHP. but I am still getting this error.
<?php
$serverName ="tcp:myserver.database.windows.net,1433";
$usr="username";
$pwd="password";
$db="SensorDataBase";
$connectionInfo = array("UID" => $usr, "PWD" => $pwd, "Database" => $db);
$conn = sqlsrv_connect($serverName, $connectionInfo);
if( $conn )
{
echo "Connected";
}
else
{
echo "Error As follows: ";
die( print_r( sqlsrv_errors(), true));
}
$sql = "CREATE TABLE fyi_links ("
. " id INT NOT NULL VARCHAR (6)"
. ", url VARCHAR(80) NOT NULL"
. ", notes VARCHAR(1024)"
. ", counts INT"
. ", time DATETIME"
. ")";
$res = sqlsrv_query($conn, $sql);
//$res = sqlsrv_query($sql,$conn);
if (!$res) {
print('Table creation failed with error:\n');
print(" ".sqlsrv_get_last_message()."\n");
}
else {
print("Table fyi_links created.\n");
}
mssql_close( $conn);
?>