我正在尝试为游戏服务器购买物品,并且正在使用他人编写的代码。我已经通过一些错误解决了我的问题,但这使我挠头。
在从PayPal沙箱返回的旅程中,我最终遇到此错误。
错误:SQLSTATE [42000]:[Microsoft] [用于SQL的ODBC驱动程序17 服务器] [SQL Server]'='附近的语法不正确。中的错误: C:\ inetpub \ wwwroot \ shop \ include \ querydbSQL.php行:98
我已经确认了PDO驱动程序,PHP版本,MySQL和SQLSERVER的访问权限。
function Update($dbname, $table, $array, $where) {
try {
$parts = array();
foreach ($array as $key => $value) {
$parts[] = "[" . $key . "] = '" . $value . "'";
}
$sth = $this->dbSql->prepare("UPDATE [$dbname].[dbo].[$table] SET " . implode(",", $parts) . " WHERE $where");
$data = $sth->execute(); <-------- Line 98
return $data;
} catch (Exception $ex) {
if(DEV_MODE === true){
echo "The Error : " . $ex->getMessage() . "<br />";
echo "The Error in : " . $ex->getFile() . "<br />";
echo "Line : " . $ex->getLine() . "<br />";
} else {
echo "[2004]The System has some error, Please contact with Administrator!";
}
die;
}
非常感谢任何指导。谢谢!
function SelectWhere($dbname, $table, $where) {
try {
$sth = $this->dbSql->prepare("SELECT * FROM [$dbname].[dbo].[$table] WHERE $where ");
$sth->setFetchMode(PDO::FETCH_ASSOC);
$sth->execute();
$data = $sth->fetchAll();
return $data;
} catch (Exception $ex) {
if(DEV_MODE === true){
echo "The Error : " . $ex->getMessage() . "<br />";
echo "The Error in : " . $ex->getFile() . "<br />";
echo "Line : " . $ex->getLine() . "<br />";
} else {
echo "[2003]The System has some error, Please contact with Administrator!";
}
die;
}
}