SQL UPDATE Query - Basic stuff but can't see what's wrong?
I'm just trying to do an update command with SQL but have never really used it. I currently have the command like this:
UPDATE 'assets' SET 'SKU' = "Another",
'Quantity' = "3",
'Description' = "Another thing",
'Value' = "2100",
'Location' = "Acheroon",
'Owner' = "Fergus",
'Image' = "Nope",
'Notes' = "" WHERE 'Index' = "2"
I have tried running it 开发者_JS百科both through my PHP layer and straight into the database. What's up?
Replace '
with ` and then "
with '
Try this:
UPDATE `assets`
SET `SKU` = 'Another',
`Quantity` = '3',
`Description` = 'Another thing',
`Value` = '2100',
`Location` = 'Acheroon',
`Owner` = 'Fergus',
`Image` = 'Nope',
`Notes` = ''
WHERE `Index` = '2'
or
UPDATE assets
SET SKU = 'Another',
Quantity = '3',
Description = 'Another thing',
Value = '2100',
Location = 'Acheroon',
Owner = 'Fergus',
Image = 'Nope',
Notes = ''
WHERE `Index` = '2'
精彩评论