SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru adammc's Avatar
    Join Date
    Aug 2004
    Location
    Cairns, Australia
    Posts
    762
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face SQL Update query in PHPMyadmin

    Hello,

    I was hoping someone could help me figure out how to do a quick update rather than having to manually update each and every entry in the list.


    I want to do something like this:

    UPDATE Products SET giftwrapping = '0' WHERE product_id = ANY FROM THIS LIST BELOW

    151
    166
    689
    109
    860
    260
    901
    300
    817
    861
    295
    1
    2
    3

    This query will be entered into phpMyadmin so I am just not sure how to construct the array like query.
    Any help would be greatly appreciated.

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,127
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    You want to use IN

    Code SQL:
    UPDATE Products SET giftwrapping = '0' WHERE product_id IN (151,166,689,109,860,260,901,300,817,861,295,1,2,3)


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
  •