SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 21/05/2019, 09:19 PM   #1
wilking
Big Clucker
 
Join Date: May 2017
Posts: 57
Reputation: 0
Default Help Me Query Problem

hello everybody .

pls help me this problem .

i use linux and when i run query on mysql of linux . everything is normal and stable .
But run query on samp , it don't work .

i have print for check on log
PHP Code:
[04:12:48query UPDATE `ggroupsset `sltv` = (select COUNT(*) from `accountswhere `GMember` = 0where `Id` = 0
[04:12:48query UPDATE `ggroupsset `sltv` = (select COUNT(*) from `accountswhere `GMember` = 1where `Id` = 1
[04:12:48query UPDATE `ggroupsset `sltv` = (select COUNT(*) from `accountswhere `GMember` = 2where `Id` = 2
[04:12:48query UPDATE `ggroupsset `sltv` = (select COUNT(*) from `accountswhere `GMember` = 3where `Id` = 3
[04:12:48query UPDATE `ggroupsset `sltv` = (select COUNT(*) from `accountswhere `GMember` = 4where `Id` = 4
[04:12:48query UPDATE `ggroupsset `sltv` = (select COUNT(*) from `accountswhere `GMember` = 5where `Id` = 5
[04:12:48query UPDATE `ggroupsset `sltv` = (select COUNT(*) from `accountswhere `GMember` = 6where `Id` = 6
[04:12:48query UPDATE `ggroupsset `sltv` = (select COUNT(*) from `accountswhere `GMember` = 7where `Id` = 7
[04:12:48query UPDATE `ggroupsset `sltv` = (select COUNT(*) from `accountswhere `GMember` = 8where `Id` = 8
[04:12:48query UPDATE `ggroupsset `sltv` = (select COUNT(*) from `accountswhere `GMember` = 9where `Id` = 
this query working so good on mysql linux . but on pawn is not.

my stock
PHP Code:
stock LoadCountGGroup() { //team
    //printf("[LoadCountGGroups] Loading data from database...");
    
new qr[1024];
    new 
str[1024];
    for(new 
i=0i<MAX_GGROUPSi++){
        
format(strsizeof(str), "(select COUNT(*) from `accounts` where `GMember` = %d)"i);
        
format(qrsizeof(qr) , "UPDATE `ggroups` set `sltv` = %s where `Id` = %d"str,i);    
        
printf("query : %s",qr);
    }
    
mysql_function_query(MainPipelineqrfalse"OnQueryFinish""i"SENDDATA_THREAD);
    
printf("[UpdateCountGGROUP] Loaded");
    return 
1;

help me please . thank you very much
wilking is offline   Reply With Quote
Old 21/05/2019, 10:00 PM   #2
austin070
Huge Clucker
 
austin070's Avatar
 
Join Date: Aug 2010
Posts: 375
Reputation: 18
Default Re: Help Me Query Problem

pawn Code:
format(str, sizeof(str), "(select COUNT(*) from `accounts` where `GMember` = '%d')", i); // added '' around your specifier
format(qr, sizeof(qr) , "UPDATE `ggroups` set `sltv` = '%s' where `Id` = '%d'", str,i);     // added '' around your specifier

I believe this should fix it.
austin070 is offline   Reply With Quote
Old 22/05/2019, 05:26 AM   #3
wilking
Big Clucker
 
Join Date: May 2017
Posts: 57
Reputation: 0
Default Re: Help Me Query Problem

I have tried but it's failed

Is there any other way?
wilking is offline   Reply With Quote
Old 22/05/2019, 06:07 AM   #4
wilking
Big Clucker
 
Join Date: May 2017
Posts: 57
Reputation: 0
Default Re: Help Me Query Problem

Quote:
Originally Posted by austin070 View Post
pawn Code:
format(str, sizeof(str), "(select COUNT(*) from `accounts` where `GMember` = '%d')", i); // added '' around your specifier
format(qr, sizeof(qr) , "UPDATE `ggroups` set `sltv` = '%s' where `Id` = '%d'", str,i);     // added '' around your specifier

I believe this should fix it.
thank for your help . i succeed . Thank very much However it dont work
wilking is offline   Reply With Quote
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Another query problem Mauricee Scripting Help 2 15/02/2014 10:45 AM
Little SQL query problem IgrexolonO Scripting Help 1 26/01/2013 11:19 AM
Query problem. Rokzlive Help Archive 6 10/04/2011 10:16 PM
Failed to exeute query. Lost connection to MySQL server during query. *IsBack Help Archive 10 06/01/2011 08:50 AM


All times are GMT. The time now is 02:32 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.