Raised This Month: $ Target: $400
 0% 

MYSQL - weird bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 06-17-2011 , 14:04   Re: MYSQL - weird bug
Reply With Quote #1

If I were you, I would recode it in a more efficient way. The tutorial you used isn't very good, but if you don't want to mess with it, you can just manually remove duplicate rows and then set steamid as PRIMARY KEY (it won't allow rows with same steamid to be inserted again).

Quote:
Originally Posted by Clauu View Post
1 - in his code that if statement will be true everytime.
2 - it isn't but is much better to select only what you need.
3 - where in this topic did you see the use/encouragement of that?
1 - You are wrong. I can't see why would it be always true and also if it was always true then it would insert additional row everytime player connects, but Schwabba clearly said that it happens only every once in a while.
2 - It's not worth the trouble if you want to skip only ~2 (name and steamid ?) out of 80+ fields.
3 - Ah, sorry, that was from Schwabba's post. I must have been half asleep when I was reading it and I mistook it for yours
__________________
Impossible is Nothing
Sylwester is offline
Schwabba
Senior Member
Join Date: Apr 2008
Old 06-18-2011 , 11:25   Re: MYSQL - weird bug
Reply With Quote #2

There are 10.000 entries in that database, i can't remove them all manually. Is'nt there a MYSql-Code for that?

Or maybe i make a backup and do it with a msl or php script.
Schwabba is offline
DjOptimuS
Senior Member
Join Date: Jan 2009
Old 06-17-2011 , 08:34   Re: MYSQL - weird bug
Reply With Quote #3

Maybe they are more entrys for the same steamid because the users change theyre nick
DjOptimuS is offline
Schwabba
Senior Member
Join Date: Apr 2008
Old 06-17-2011 , 11:18   Re: MYSQL - weird bug
Reply With Quote #4

It looks like that: http://www.abload.de/img/mysqlbugqhbd.jpg
Schwabba is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 06-18-2011 , 13:55   Re: MYSQL - weird bug
Reply With Quote #5

I didn't mean to remove them one by one, but all at once.
The easiest is probably this:
PHP Code:
CREATE TABLE furienmoney2 SELECT DISTINCT FROM furienmoney;
ALTER TABLE furienmoney2 ADD PRIMARY KEY (steamid); 
It copies unique entries from furienmoney to furienmoney2 and adds primary key.

Now you only need to edit your plugin to make it use table furienmoney2.
__________________
Impossible is Nothing
Sylwester is offline
johnally
Member
Join Date: May 2011
Location: Mauritius
Old 06-18-2011 , 14:48   Re: MYSQL - weird bug
Reply With Quote #6

to remove everything from that table
PHP Code:
DELETE FROM furienmoney 
you might consider Sylwester sql statements to create table then!

And re-think the coding!
__________________
No allowed!

johnally is offline
Schwabba
Senior Member
Join Date: Apr 2008
Old 06-25-2011 , 02:10   Re: MYSQL - weird bug
Reply With Quote #7

Ayayay, it took 7 hours to delete duplicated entrys. I deleted more than 8k lines and i added a primkey now. I hope now it works without bugs.
Schwabba is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-25-2011 , 11:27   Re: MYSQL - weird bug
Reply With Quote #8

Quote:
Originally Posted by Schwabba View Post
Ayayay, it took 7 hours to delete duplicated entrys. I deleted more than 8k lines and i added a primkey now. I hope now it works without bugs.
That could have easily been avoided.

Code:
CREATE TABLE furienmoney2 SELECT DISTINCT * FROM furienmoney;
ALTER TABLE furienmoney2 ADD PRIMARY KEY (steamid);
DROP TABLE furienmoney;
ALTER TABLE furienmoney2 RENAME TO furienmoney;
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Schwabba
Senior Member
Join Date: Apr 2008
Old 07-01-2011 , 12:02   Re: MYSQL - weird bug
Reply With Quote #9

I tried, but i stops on the first duplicated entry (had only 217 entries).
Schwabba is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-01-2011 , 15:05   Re: MYSQL - weird bug
Reply With Quote #10

Try this then:
Code:
CREATE TABLE furienmoney2 SELECT * FROM furienmoney GROUP BY steamid;
ALTER TABLE furienmoney2 ADD PRIMARY KEY (steamid);
DROP TABLE furienmoney;
ALTER TABLE furienmoney2 RENAME TO furienmoney;
Hopefully you didn't drop the original table yet so you can still try these new methods.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:30.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode