Raised This Month: $ Target: $400
 0% 

Save player data to mysql


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-31-2018 , 17:52   Re: Save player data to mysql
Reply With Quote #1

CrazY your query is wrong. You are not specifying the fields for the data you are trying to set.

My bad crazy, you're right. As long as all fields are supplied and in the correct order, your method will work. I've never personally used INSERT without specifying field names and I literally write SQL at work almost every day. Still, I think it's good practice to include field names, but thats just my opinion.

jonatat, when a player connects then use a query to retrieve their data and store it in an array. On disconnect, if data exists in the array, use an UPDATE statement. If the array is null, use an INSERT statement.

Code:
INSERT INTO tblTest (SteamID, Val1, Val2) VALUES ('STEAM:0:12345',12,34);

UPDATE tblTest SET Val1=55, Val2=66 WHERE SteamID='STEAM:0:12345';
__________________

Last edited by Bugsy; 05-31-2018 at 20:14.
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 04:43.


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