我只是尝试使用SQL执行更新命令,但从未真正使用它。我目前有这样的命令:
UPDATE 'assets' SET 'SKU' = "Another",
'Quantity' = "3",
'Description' = "Another thing",
'Value' = "2100",
'Location' = "Acheroon",
'Owner' = "Fergus",
'Image' = "Nope",
'Notes' = "" WHERE 'Index' = "2"
我尝试通过PHP层运行它,直接进入数据库。怎么了?
答案 0 :(得分:4)
将'
替换为`,然后将"
替换为'
试试这个:
UPDATE `assets`
SET `SKU` = 'Another',
`Quantity` = '3',
`Description` = 'Another thing',
`Value` = '2100',
`Location` = 'Acheroon',
`Owner` = 'Fergus',
`Image` = 'Nope',
`Notes` = ''
WHERE `Index` = '2'
或
UPDATE assets
SET SKU = 'Another',
Quantity = '3',
Description = 'Another thing',
Value = '2100',
Location = 'Acheroon',
Owner = 'Fergus',
Image = 'Nope',
Notes = ''
WHERE `Index` = '2'