...

View Full Version : How to modify one value in MySql?



Krupski
12-30-2011, 04:35 AM
Hi all,

I've been beating my head against the wall for a few hours now and just not getting it.

I have a message board database and I want to know the MySQL syntax for changing a value.

It's in a database name "phpbb", the table is "phpbb_config" and the item name is "smiley_max_width" (there's also a max_height, but if I can do one I can do the other!)

This is the bottom end of a "SELECT * FROM phpbb_config;" command:



| user_dst | 1 | 0 |
| smiley_max_width | 36 | 0 |
| smiley_max_height | 24 | 0 |
+------------------------------+------------------------------------------------------------+------------+
281 rows in set (0.00 sec)
Now, this command: SELECT * FROM phpbb_config WHERE config_name = "smiley_max_width";

Gives me:



+------------------+--------------+------------+
| config_name | config_value | is_dynamic |
+------------------+--------------+------------+
| smiley_max_width | 36 | 0 |
+------------------+--------------+------------+
1 row in set (0.00 sec)
All I want to do is be able to MODIFY the value of "36" programmatically.

Thanks......

-- Roger

guelphdad
12-30-2011, 06:42 AM
MODIFY is used to change the structure of the table itself.
UPDATE is used to change the values in the table.

Old Pedant
12-30-2011, 07:46 AM
UPDATE phpbb_config SET config_value = '93817 bonanza' WHERE config_name = 'smiley_max_width';

That's probably not the value you want, but it's a fun value.

Pardon me for asking, but did you consider just looking in the MySQL docs?

http://dev.mysql.com/doc/refman/5.1/en/update.html



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum