Raised This Month: $ Target: $400
 0% 

[ H3LP ] Load data failure


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-23-2018 , 11:24   Re: [ H3LP ] SQLx load data
Reply With Quote #1

I have the below observations, let me know if I am not understanding the flow correctly. You did not post your full plugin so I am making assumptions based on what you posted.

1. You attempt to retrieve the data from the db and if no rows are returned you write a row for the player.
2. Data for a player does not get updated on each disconnect since you are only inserting if the player had no data saved which will only happen on his first time on the server.

You should be using INSERT only if it's the players first time on the server, from then on you should be using UPDATE. You can use REPLACE INTO if you set auth as primary key which will overwrite the same row each time.
Code:
CREATE TABLE IF NOT EXISTS player (auth varchar(32) PRIMARY KEY, ammop int(11));

REPLACE INTO player (auth, ammop) VALUES ('STEAM_0:0:12345',77);
Not thoroughly tested
Spoiler
__________________

Last edited by Bugsy; 06-23-2018 at 15:03.
Bugsy 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 12:39.


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