By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,626 Members | 2,202 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,626 IT Pros & Developers. It's quick & easy.

Newbie question about Inserting values

pafranklin
P: 2
Hi there,

Apologies in advance for the "simple question", but I am relatively new to MySQL.

I have a database driven website and have within the database a number of fields in a certain category that are blank. I want to write a script that puts the number 0 into each of these fields if possible?

The table is "products_shipping" and the fields that I want to infill blanks with 0 are called "products_ship_price" and "products_ship_price_two".

Please could someone suggest how I can do this?

Many thanks.

Paul.
Sep 24 '06 #1
Share this Question
Share on Google+
3 Replies


ronverdonk
Expert 2.5K+
P: 4,258
I think that you need 2 passes, one for each column:
Expand|Select|Wrap|Line Numbers
  1. UPDATE products_shipping SET products_ship_price='0' 
  2.             WHERE products_ship_price=' ';
  3. UPDATE products_shipping SET products_ship_price_two='0' 
  4.             WHERE products_ship_price_two=' ';
  5.  
Ronald :cool:
Sep 24 '06 #2

pafranklin
P: 2
Thank you so much. It worked a treat!!

Now all I have to do is start wading through the tutorials properly so that I do not have to ask silly questions next time!!

Thanks again.

Paul.
Sep 26 '06 #3

ronverdonk
Expert 2.5K+
P: 4,258
No question is silly, usually the answer is.
Sep 26 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.