我刚开始使用 odbc 函数。 我试图简单地执行一个简单的查询,但我没有收到错误或结果。 我不确定出了什么问题。
$server = [hidden];
$database = [hidden];
$user = [hidden];
$password = [hidden];
$connection = odbc_connect("Driver={ODBC Driver 13 for SQL Server};Server=$server;Database=$database;", $user, $password);
if ($connection) {
$mail = '[email protected]';
$queryc = "SELECT COUNT(*) AS [Found] FROM [Table].[dbo].[Persons] WHERE [Address] = '$mail'";
$resultsc = odbc_exec($connection, $queryc);
if( !$resultsc ) {
die( print_r( odbc_error())));
} else {
'hi!';
}
}
找出问题所在。 这样做是固定的:
$server = [hidden];
$database = [hidden];
$user = [hidden];
$password = [hidden];
$connection = odbc_connect("Driver={ODBC Driver 13 for SQL Server};Server=$server;Database=$database;", $user, $password);
$queryc = "SELECT COUNT(*) AS [Found] FROM [Table].[dbo].[Persons] WHERE [Address] = 'mail'";
$resultsc = odbc_exec($connection, $queryc);
if (!$resultsc) {
trigger_error(odbc_errormsg(), E_USER_ERROR);
}