Raised This Month: $ Target: $400
 0% 

Whats wrong with this SQL query?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shauli
Member
Join Date: Jun 2018
Old 06-15-2018 , 05:57   Re: Whats wrong with this SQL query?
Reply With Quote #1

You are overwriting 'szQuery' again and again. The problem is in the amxx code, not in the query.
Try something like this:
PHP Code:
formatexszQuery999"UPDATE `users` SET `MLP` = 'MLP + 1' WHERE steam_id = '%s';"MLPsteamid);  
SQL_ThreadQueryg_hTuple"QuerySetData"szQuery); 
formatexszQuery999"UPDATE `matches` SET `MVP_steamid` = '%s', `MLP_steamid` = '%s' WHERE match_id = '%s';"MVPsteamidMLPsteamidszLine);  
SQL_ThreadQueryg_hTuple"QuerySetData"szQuery); 
Also I recommend you to merge the 1st and the 2nd query to a single query.

You can also try like this:
PHP Code:
formatexszQuery999"UPDATE `users` SET `MLP` = 'MLP + 1' WHERE steam_id = '%s';UPDATE `matches` SET `MVP_steamid` = '%s', `MLP_steamid` = '%s' WHERE match_id = '%s';"MLPsteamidMVPsteamidMLPsteamidszLine);  
SQL_ThreadQueryg_hTuple"QuerySetData"szQuery); 
But i'm not sure if it's works in here. As far as I know, you have to pre-configure that you want to allow multiple queries and I don't know if it's possible in AMXX, but worth a try.
shauli is offline
jonatat
Senior Member
Join Date: Dec 2017
Old 06-15-2018 , 06:23   Re: Whats wrong with this SQL query?
Reply With Quote #2

Thanks for reply. Ok so i tried:

PHP Code:
formatexszQuery999"UPDATE `users` SET `MVP` = 'MVP + 1' WHERE steam_id = '%s';"MVPsteamid);
SQL_ThreadQueryg_hTuple"QuerySetData"szQuery);
formatexszQuery999"UPDATE `users` SET `MLP` = 'MLP + 1' WHERE steam_id = '%s';"MLPsteamid); 
SQL_ThreadQueryg_hTuple"QuerySetData"szQuery); 
formatexszQuery999"UPDATE `matches` SET `MVP_steamid` = '%s', `MLP_steamid` = '%s' WHERE match_id = '%s';"MVPsteamidMLPsteamidszLine); 
SQL_ThreadQueryg_hTuple"QuerySetData"szQuery); 
log_amx(szQuery
Same thing...

LOG:

PHP Code:
UPDATE `matchesSET `MVP_steamid` = 'STEAM_0:0:107365441', `MLP_steamid` = 'STEAM_0:0:155654489' WHERE match_id 'fG5A8F46EDJb4c5ec8271a71'
But nothing about `users` ... why?

Last edited by jonatat; 06-15-2018 at 06:34.
jonatat 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:40.


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