I have recently taken over the running of an e-commerce website. Once in a while i will need to increase the prices of certain products by any given percenatge. The products all have a code starting with 3 letters and then digits. for instance: ffc1234, ffc1245, dcc4544, dcc5799, vff300, and so on. I may only have to update the dcc prices one month, and the ffc the next. I need to know the UPDATE query to be able to do this.

The product codes are in a column called prod_code and the prices that need to be updated are in a column called prod_prices.

I need to run an UPDATE query in PHPMYADMIN. ... can anyone help?

Welcome bubbafunk1.
So you are not exeuting update query. Isn't it? Write your update statement so we can help you.

Basically, I only started learning MYSQL 2 days ago, so I dont really know much.

Thanks for your reply!

I just want to update a table called products, and change the prices in a column called p_price by adding 10% to the prices of the products whos p_code start with ffc, dde and bgg.

This is what I think the code should look like, but obviously... it should work.

UPDATE products SET 'p_price' 'p_price' +0.9 WHERE p_code = 'ffc%, dde%, bgg%,

you will have to excuse my lack of mysql knowledge.

Any pointers will be greatly appreciated.

Hi,

You can do something similar to what I did below.

update products set p_price = p_price * 1.10 WHERE p_code LIKE 'ffc%' or p_code LIKE 'dcc%';

Hi,

You can do something similar to what I did below.

update products set p_price = p_price * 1.10 WHERE p_code LIKE 'ffc%' or p_code LIKE 'dcc%';

Thanks for the code... it worked a treat! Just what I needed.

Thanks
Kevin

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.