Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2009
    Posts
    2
    Plugin Contributions
    0

    Default Query to execute if then in phpmyadmin

    Hello,

    My phpmyadmin table is mismatched after i last edited it.
    Is there a query i can use in this format =

    IN table My_Products
    If the "product ID"="300" then make the "product_Type"="Green" and "product_price"="4.00"
    If the "STD Code"="5925" then make the "product_type"="Blue" and "product_price"="2.50"

    Pls help. I have about 1000 list, and doing it manually is not going to help. I can create a bulk sql if you help me with just one as to how the code will be.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Query to execute if then in phpmyadmin

    You won't use an If/Then. Instead, you'll do mass-updates with a appropriate WHERE clauses. ie:

    UPDATE My_Products set product_Type = 'Green', product_price=4.00 WHERE productID = 300;

    UPDATE My_Products set product_type = 'Blue', product_price = 2.50 WHERE STDCode = 5925;
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Nov 2009
    Posts
    2
    Plugin Contributions
    0

    Default Re: Query to execute if then in phpmyadmin

    Quote Originally Posted by DrByte View Post
    You won't use an If/Then. Instead, you'll do mass-updates with a appropriate WHERE clauses. ie:

    UPDATE My_Products set product_Type = 'Green', product_price=4.00 WHERE productID = 300;

    UPDATE My_Products set product_type = 'Blue', product_price = 2.50 WHERE STDCode = 5925;

    Thanks Drbyte. I had to make one change to it,

    UPDATE My_Products set product_Type = 'Green', product_price=4.00 WHERE productID = '300';

    The last one comes in quotation marks. thanks alot

 

 

Similar Threads

  1. Replies: 2
    Last Post: 3 Dec 2014, 12:19 AM
  2. Need help w/ SQL query in phpMyAdmin
    By audradh in forum General Questions
    Replies: 17
    Last Post: 16 Nov 2009, 01:05 PM
  3. Specifying 'Product priced by attributes' by running phpmyadmin SQL query?
    By vandiermen in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 2 Aug 2009, 06:34 AM
  4. Query RE: phpmyadmin
    By sara73 in forum General Questions
    Replies: 1
    Last Post: 14 Jun 2008, 02:52 AM

Posting Permissions

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