开发者

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' 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜