0
INSERT INTO [dbp_mod].[dbo].[Logs] (UserID, DB_Type, DB_Name, TableName, FieldName, OldValue, NewValue, SearchFields, SearchValues, Action, ActionIP, ActionTime) VALUES (1, 'DBF', 'E:\dbf\dbtest.dbf', 'E:\dbf\dbtest.dbf', 'f3', '8', '10', 'f1', '1', 'Edited', '192.168.2.124', GetDate());
此查詢有什麼問題?它在Management Studio中運行正常,但產生與PHP此查詢有什麼問題?
Warning: mssql_query(): supplied argument is not a valid MS SQL-Link resource in
錯誤
$query = "INSERT INTO [dbo].[Logs] (UserID, DB_Type, DB_Name, TableName, FieldName, OldValue, NewValue, SearchFields, SearchValues, Action, ActionIP, ActionTime)
VALUES ($data[UserID], '$data[DB_Type]', '$data[DB_Name]', '$data[TableName]', '$data[FieldName]', '$data[OldValue]', '$data[NewValue]', '$data[SearchFields]', '$data[SearchValues]', '$data[Action]', '$data[ActionIP]', GetDate()); ";
echo "<br>$query";
if(!mssql_query($query, $db)){
$successFlag = FALSE;
} else {
$successFlag = TRUE;
}
我敢肯定,我在這兩個選擇分貝$db
爲
INSERT INTO [dbp_mod].[dbo].[Logs] (UserID, DB_Type, DB_Name, TableName, FieldName, OldValue, NewValue, SearchFields, SearchValues, Action, ActionIP, ActionTime) VALUES (1, '', '', '', '', '', '', '', '', 'Logged in ', '192.168.2.124', GetDate());
沒有工作PHP和管理工作室
警告:您的代碼易受sql注入攻擊。 –
與db的連接存在問題。這將是'$ db'變量。 – thetaiko