Raised This Month: $ Target: $400
 0% 

Whats wrong with this SQL query?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jonatat
Senior Member
Join Date: Dec 2017
Old 06-15-2018 , 07:08   Re: Whats wrong with this SQL query?
Reply With Quote #1

Quote:
Originally Posted by shauli View Post
You're only logging the last line. If you want to log all 3 you'll have to use log_amx each time *before* you overwrite it again with formatex, like this:
PHP Code:
formatexszQuery999"UPDATE `users` SET `MVP` = 'MVP + 1' WHERE steam_id = '%s';"MVPsteamid);
log_amx(szQuery

SQL_ThreadQueryg_hTuple"QuerySetData"szQuery);

formatexszQuery999"UPDATE `users` SET `MLP` = 'MLP + 1' WHERE steam_id = '%s';"MLPsteamid); 
log_amx(szQuery

SQL_ThreadQueryg_hTuple"QuerySetData"szQuery); 

formatexszQuery999"UPDATE `matches` SET `MVP_steamid` = '%s', `MLP_steamid` = '%s' WHERE match_id = '%s';"MVPsteamidMLPsteamidszLine); 
log_amx(szQuery

SQL_ThreadQueryg_hTuple"QuerySetData"szQuery); 
Here's an example for the mistake:
PHP Code:
formatexszQuery999"hello!" ); //szQuery is now 'hello!'
formatexszQuery999"good morning!" ); //szQuery is now 'good morning!'
formatexszQuery999"good night!" ); //szQuery is now 'good night!'
log_amxszQuery ); //'good night!' logged 
Ok really weird. Not working + 1 syntax, not code. I tried like that:

PHP Code:
formatexszQuery999"UPDATE `users` SET `MVP` = '1' WHERE steam_id = '%s';"MVPsteamid); 
SQL_ThreadQueryg_hTuple"QuerySetData"szQuery);

formatexszQuery999"UPDATE `users` SET `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
And works fint, just offcourse not counting +1. So where is mistake with + 1 ? Maybe try something like that? :

PHP Code:
formatexszQuery999"UPDATE `users` SET MLP = MLP + 1 WHERE steam_id = '%s';"MLPsteamid); 
jonatat is offline
shauli
Member
Join Date: Jun 2018
Old 06-15-2018 , 07:25   Re: Whats wrong with this SQL query?
Reply With Quote #2

Quote:
Originally Posted by jonatat View Post
Ok really weird. Not working + 1 syntax, not code. I tried like that:

PHP Code:
formatexszQuery999"UPDATE `users` SET `MVP` = '1' WHERE steam_id = '%s';"MVPsteamid); 
SQL_ThreadQueryg_hTuple"QuerySetData"szQuery);

formatexszQuery999"UPDATE `users` SET `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
And works fint, just offcourse not counting +1. So where is mistake with + 1 ? Maybe try something like that? :

PHP Code:
formatexszQuery999"UPDATE `users` SET MLP = MLP + 1 WHERE steam_id = '%s';"MLPsteamid); 
Yep, you wrote SET `MVP` = 'MVP + 1' instead of SET `MVP` = 'MVP' + '1' or SET `MVP` = MVP + 1.
shauli 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