Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to overwrite number is mysql file please

Status
Not open for further replies.

robinantill

Technical User
Mar 22, 2001
6
GB
Hi,
I have a mysql database and I want to reset the values of one of the numerical fields to another numerical value.

By using the following I can change the value of all of the fields which are '1' to '33' but what I want is not to put a value in for the existing values in the field but have all fields selected and replaced with '33' or whatever i.e. the second example:-

UPDATE phpbb_banlist SET ban_userid = replace(ban_userid,"1","33");

UPDATE phpbb_banlist SET ban_userid = replace(ban_userid,"*","33");

I.E. what do I need to do to replace all the values in the field to a set value.

Thanks,
Robin Antill
 
UPDATE phpbb_banlist SET ban_userid = "33";

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Hi,
Further to my original query, is it possible to update phpbb_banlist conditionally, i.e.

If phpbb_banlist ="30" then UPDATE phpbb_banlist SET ban_userid = "33";

or

If phpbb_banlist ="30" then UPDATE phpbb_banlist SET ban_userid = "33"; otherwise phpbb_banlist ="6"

Thanks,
Robin
 
Suggest you read faq222-2244 to see how to get the best from these forums. It gives guidance on many aspects of forum usage, including basic research. One resource that you should have access to, and use first for these simple questions, is:

For this question, try
Code:
UPDATE phpbb_banlist SET ban_userid = "33" WHERE ban_userid = "30";

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top