Author |
Message |
sittingduck
Hangin' Around

Joined: Oct 20, 2005
Posts: 26
|
Posted:
Wed Nov 02, 2005 3:20 am |
|
I want to edit the nuke_users table so that anyone with user_timezone -7 gets changed to user_timezone -8.
Is this possible without manually changing each one? I figured out how to list ONLY the users with -7, but I have no idea how to edit them en masse. Or if it is even possible. |
|
|
 |
 |
montego
Site Admin

Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Wed Nov 02, 2005 6:47 am |
|
Yes, it is possible. I will assume that you have access to a tool like phpMyAdmin so that you can run a SQL command. I will also assume that you have not changed your $prefix so that all your tables start with "nuke_". Try this:
Code:
UPDATE `nuke_users` SET `user_timezone` = -8
|
Now, make CERTAIN you really want to change everyone's timezone because this will change everyone in the database.
Regards,
montego |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
 |
sittingduck

|
Posted:
Wed Nov 02, 2005 11:09 am |
|
I checked all my users, and except for a couple that hadn't changed from default, all were either -7 or already -8. (mostly local people) The SQL command worked perfectly, THANKS!
I just discovered that it could be taken one step futher, with the WHERE command like so:
UPDATE nuke_users SET user_timezone = -8 WHERE user_timezone = -7
 |
|
|
|
 |
Steptoe
Involved


Joined: Oct 09, 2004
Posts: 293
|
Posted:
Wed Nov 02, 2005 1:33 pm |
|
Out of interest, what is the thinking behind doing so? |
_________________ My Spelling is NOT incorrect, it's Creative |
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Wed Nov 02, 2005 1:37 pm |
|
sittingduck wrote: | I checked all my users, and except for a couple that hadn't changed from default, all were either -7 or already -8. (mostly local people) The SQL command worked perfectly, THANKS!
I just discovered that it could be taken one step futher, with the WHERE command like so:
UPDATE nuke_users SET user_timezone = -8 WHERE user_timezone = -7
| Whew! I was just getting ready to tell you to be sure to add that WHERE clause  |
|
|
|
 |
sittingduck

|
Posted:
Wed Nov 02, 2005 1:42 pm |
|
Steptoe wrote: | Out of interest, what is the thinking behind doing so? |
Daylight savings time causes the forum to be off by an hour. Meaning in my timezone (GMT - settings need to be at -7 for the time to display properly. When we recently went back to standard time, it meant that -7 was now an hour off! So, instead of telling everyone (or waiting for them to figure it out) to change their timezone settings, I did it through the database. |
|
|
|
 |
sittingduck

|
Posted:
Wed Nov 02, 2005 1:45 pm |
|
Raven wrote: | Whew! I was just getting ready to tell you to be sure to add that WHERE clause |
Thanks Raven, I actually ran the command without the WHERE, because all of my users are in the same timezone. Someday that may chage though, so I am glad to be aware of the ability to single out specific values. |
|
|
|
 |
Steptoe

|
Posted:
Wed Nov 02, 2005 2:07 pm |
|
|
|
 |
sittingduck

|
Posted:
Wed Nov 02, 2005 2:21 pm |
|
Steptoe wrote: | http://www.ravenphpscripts.com/posts6960-highlight-.html
There maybe some added usefull info there for u...check dates in the 1st code blocks |
Whoa now, I just figured out how to run an SQL query, what makes you think I'm ready to decipher all that? maybe someday... |
Last edited by sittingduck on Wed Nov 02, 2005 3:09 pm; edited 1 time in total |
|
|
 |
Steptoe

|
Posted:
Wed Nov 02, 2005 2:55 pm |
|
just the country and dates preceeded by /// |
|
|
|
 |
Raven

|
Posted:
Wed Nov 02, 2005 3:29 pm |
|
Steptoe wrote: | http://www.ravenphpscripts.com/posts6960-highlight-.html
There maybe some added usefull info there for u...check dates in the 1st code blocks |
I just added to that post http://www.ravenphpscripts.com/postp51449.html#51449 to explain an easy way to automatically calculate it  |
|
|
|
 |
montego

|
Posted:
Wed Nov 02, 2005 5:42 pm |
|
Awesome Raven!! Looking forward to the new release. Good stuff. |
|
|
|
 |
|