我正在尝试通过php连接mssql server 2014。我正在执行的脚本在我的网络托管上是实时的,这是我正在运行的脚本
<?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'
?>
我得到的错误是
在第18行的sql.php中调用未定义的函数odbc_connect()