Previous Thread
Next Thread
Print Thread
Hop To
#216413 08/11/2008 11:51 PM
Joined: Dec 2003
Posts: 1,796
Pooh-Bah
Pooh-Bah
Joined: Dec 2003
Posts: 1,796
Due to usergroup issues from the upgrade, I need to update everyone's usergroup who is a guest to user
Code
UPDATE ubbt_USER_GROUPS SET GROUP_ID = '4' WHERE GROUP_ID = '5'

Except for USER_ID #1.

:help:


- Allen
- ThreadsDev | PraiseCafe
AllenAyres #216414 08/12/2008 12:00 AM
Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
add 'AND USER_ID > 1' to the clause

bada bing! smile

SD #216422 08/12/2008 10:40 AM
Joined: Dec 2003
Posts: 1,796
Pooh-Bah
Pooh-Bah
Joined: Dec 2003
Posts: 1,796
thank you, I had something similar, but of course it was erroring out.


- Allen
- ThreadsDev | PraiseCafe
AllenAyres #216423 08/12/2008 10:42 AM
Joined: Aug 2006
Posts: 1,358
Y
Veteran
Veteran
Y Offline
Joined: Aug 2006
Posts: 1,358
Statement can still error out if a user was already in group 4 also.


[Linked Image from siemons.org]
AllenAyres #216424 08/12/2008 10:43 AM
Joined: Dec 2003
Posts: 1,796
Pooh-Bah
Pooh-Bah
Joined: Dec 2003
Posts: 1,796
I'm getting the same error:

SQL Error: Duplicate entry '6-4' for key 1

I've tried this:

UPDATE ubbt_USER_GROUPS SET GROUP_ID = '4' WHERE GROUP_ID = '5' AND USER_ID > '1'

and this:

UPDATE ubbt_USER_GROUPS SET GROUP_ID = '4' WHERE GROUP_ID = '5' AND USER_ID > 1

and get the same error.


- Allen
- ThreadsDev | PraiseCafe
AllenAyres #216425 08/12/2008 11:20 AM
Joined: Aug 2006
Posts: 1,358
Y
Veteran
Veteran
Y Offline
Joined: Aug 2006
Posts: 1,358
The query goes wrong because there are already people in group 4 AND in group 5. 5 wants to change to 4, but 4 is already there, so it errors out because of the index settings.

Do this one before:

delete from ubbt_USER_GROUPS where GROUP_ID = 5 and USER_ID in (select USER_ID from ubbt_USER_GROUPS where GROUP_ID = 4)

Not exactly sure about this one, backup the table first please smile This would remove anyone from group 5 if they are already in group 4.


[Linked Image from siemons.org]
AllenAyres #216426 08/12/2008 11:28 AM
Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
Best way would probably just to get rid of everyone in group 5 and then if you have MySQL 4.1+ you can add everyone to the user's group that isn't already in a group.

SQL Query
delete from ubbt_USER_GROUPS where GROUP_ID='5' and USER_ID > 1

and then:


SQL Query
insert ubbt_USER_GROUPS(
    select ubbt_USERS.USER_ID, 4
    from ubbt_USERS
    where ubbt_USERS.USER_ID not in (
        select ubbt_USER_GROUPS.USER_ID
        from ubbt_USER_GROUPS
    )
    and ubbt_USERS.USER_ID <>1
)

On another note, I need to figure out why this is happening for some people. Out of all the ugprades I've done, I haven't had this happen.

Rick #216430 08/12/2008 4:04 PM
Joined: Dec 2003
Posts: 1,796
Pooh-Bah
Pooh-Bah
Joined: Dec 2003
Posts: 1,796
Thank you, I ended up using phpmyadmin to backup the table, edit it in ultraedit then truncate and re-install.

This particular site shows MySQL:

Client API version 3.23.58

The web host claims the server install is 4.something, but maybe the difference is the issue? I always see errors here not seen on other sites when I update it - just when I think it's safe to upgrade the bottom falls out and something simple isn't.


- Allen
- ThreadsDev | PraiseCafe
Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
Hmm, the first thing I'd do is verify the version of MySQL itself. If you run the following SQL command you can get it:

show variables

Towards the bottom you'll see the version variable that will give you the actual version running.

Rick #216435 08/12/2008 6:55 PM
Joined: Jul 2006
Posts: 2,143
Pooh-Bah
Pooh-Bah
Joined: Jul 2006
Posts: 2,143
AA, that is the MySQL client built into your php, NOT the version of MySQL itself. Rick's show variables will give you the version of MySQL. Note that the older MySQL client you have in your php might limit some of the things you can do with MySQL because that client doesn't know how to ask MySQL to do them.


This thread for sale. Click here! [Linked Image from navaho.infopop.cc]
Joined: Dec 2003
Posts: 1,796
Pooh-Bah
Pooh-Bah
Joined: Dec 2003
Posts: 1,796
version 4.1.21-standard

I understand what you're saying... for some reason I can import a hundred sites and not have a problem, but this one always gives me issues - not sure what it is.


- Allen
- ThreadsDev | PraiseCafe
AllenAyres #216442 08/13/2008 10:46 AM
Joined: Jan 2004
Posts: 56
P
journeyman
journeyman
P Offline
Joined: Jan 2004
Posts: 56
I am using 5.0.45 are there any known issues with version 5+?

(sorry not trying to Hijack the thread)

Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
nope -- i'd highly recommend going to latest (release) of mysql.. same for apache and php..

i run all of em on my sites.

SD #216451 08/13/2008 11:24 PM
Joined: Nov 2006
Posts: 3,095
Likes: 1
Carpal Tunnel
Carpal Tunnel
Joined: Nov 2006
Posts: 3,095
Likes: 1
Agreed - no problems for me either. I had my hosting provider put me on another server that was running the latest versions and all works for me.

ntdoc #216452 08/13/2008 11:37 PM
Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
i'd also recommend Linux box vs Windows box, if at all possible.. many reasons for this..

some peeps may not be able to change OSes, but if you are starting fresh, go *Nix

SD #216458 08/14/2008 11:23 PM
Joined: Dec 2003
Posts: 1,796
Pooh-Bah
Pooh-Bah
Joined: Dec 2003
Posts: 1,796
Server 2008 is looking pretty suite smile


- Allen
- ThreadsDev | PraiseCafe

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
Is UBB.threads still going?
by Aaron101 - 04/01/2022 8:18 AM
Who's Online Now
0 members (), 476 guests, and 170 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240430)