SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Update Question

  1. #1
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    Norway
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Update Question

    Are both of these valid in an update query ?
    1st
    PHP Code:
        UPDATE users SET name='test' WHERE (uid='1'
    2nd
    PHP Code:
        UPDATE users SET (user_idarmy_idVALUES (1,2), (1,3), (1,4
    because I'm getting error on the second. So I'm asking here so I dont need to sit and try find an error when its not possible to use at all

    thanks for your time

  2. #2
    SitePoint Wizard swdev's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    1,053
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    AFAIK, the second form is not valid SQL

    Here is the relevant page from the MySQL manual http://dev.mysql.com/doc/mysql/en/UPDATE.html

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,323
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    the first is valid if you overlook the fact that uid is probably numeric so '1' would be 1

    the 2nd looks like mysql's proprietary INSERT syntax which i don't think is allowed in an UPDATE statement

    my advice is to stick to standard sql for basic stuff, because mysql does support it
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    Norway
    Posts
    355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks! I think I'll know what to do now


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •