i am trying to connect mssql server 2014 through php. The script i am executing is live on my web hosting, here is the script i am running
<?php
$data_source='remoteds';
$user='<username>';
$password='<password>';
// Connect to the data source and get a handle for that connection.
$conn=odbc_connect($data_source,$user,$password);
if (!$conn){
if (phpversion() < '4.0'){
exit("Connection Failed: . $php_errormsg" );
}
else{
exit("Connection Failed:" . odbc_errormsg() );
}
}else
{
echo "Done!";
}
// Retrieves table list.
$result = odbc_tables($conn);
$tables = array();
while (odbc_fetch_row($result))
array_push($tables, odbc_result($result, "TABLE_NAME") );
// Begin table of names.
echo "<center> <table border = 1>";
echo "<tr><th>Table Count</th><th>Table Name</th></tr>";
// Create table rows with data.
foreach( $tables as $tablename ) {
$tablecount = $tablecount+1;
echo "<tr><td>$tablecount</td><td>$tablename</td></tr>";
}
// End table.
echo "</table></center>";
// Disconnect the database from the database handle.
odbc_close($conn);
print e.g. 'Current PHP version: 4.1.1'
?>
The error i am getting is
Call to undefined function odbc_connect() in sql.php on line 18