Raised This Month: $12 Target: $400
 3% 

Problem MySQL T_LoadData


Post New Thread Reply   
 
Thread Tools Display Modes
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 08-22-2019 , 07:50   Re: Problem MySQL T_LoadData
Reply With Quote #11

Ew. Non-threaded queries. Please never use non-threaded queries.
__________________
Neuro Toxin is offline
PyKw
Junior Member
Join Date: Jan 2012
Old 08-23-2019 , 14:25   Re: Problem MySQL T_LoadData
Reply With Quote #12

Quote:
Originally Posted by Neuro Toxin View Post
Ew. Non-threaded queries. Please never use non-threaded queries.
Yeah I know it sucks, currently I'm trying to use only threaded query. Can you help me? Any tips how to solve? Or can you provide me a quick snippet
PyKw is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 08-23-2019 , 16:34   Re: Problem MySQL T_LoadData
Reply With Quote #13

Use:
PHP Code:
if (results.AffectedRows
Insert, update and delete queries returns only how many rows were affected.

Search for "update on duplicate key" ("insert into table on duplicate key set") - you update the data if exists or insert if don't. You can check my Activity plugin for a snippet as well.
__________________

Last edited by Ilusion9; 08-23-2019 at 17:03.
Ilusion9 is offline
ShD3luxe
Member
Join Date: Aug 2019
Location: Localhost
Old 08-24-2019 , 14:10   Re: Problem MySQL T_LoadData
Reply With Quote #14

Quote:
Originally Posted by PyKw View Post
Yeah I know it sucks, currently I'm trying to use only threaded query. Can you help me? Any tips how to solve? Or can you provide me a quick snippet
Just change the disconnect function to :
PHP Code:
public void OnClientDisconnect(int client)
{
    if(!
IsFakeClient(client) && g_Database != null)
    {
        
char query[256], steamid[32];
        
GetClientAuthId(clientAuthId_Steam2steamidsizeof(steamid));
        
FormatEx(querysizeof(query), "UPDATE jailbreak_test SET valoare = %i WHERE steamid = '%s'"tigari[client], steamid);
        
g_Database.Query(T_Genericquery);
    }

I tested this and it's working.You already insert the data if the user is not in the database when he is connecting.

Last edited by ShD3luxe; 08-24-2019 at 14:15.
ShD3luxe is offline
Reply


Thread Tools
Display Modes

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 07:59.


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