|
Senior Member
|

06-15-2018
, 07:08
Re: Whats wrong with this SQL query?
|
#1
|
Quote:
Originally Posted by shauli
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:
formatex( szQuery, 999, "UPDATE `users` SET `MVP` = 'MVP + 1' WHERE steam_id = '%s';", MVPsteamid);
log_amx(szQuery)
SQL_ThreadQuery( g_hTuple, "QuerySetData", szQuery);
formatex( szQuery, 999, "UPDATE `users` SET `MLP` = 'MLP + 1' WHERE steam_id = '%s';", MLPsteamid);
log_amx(szQuery)
SQL_ThreadQuery( g_hTuple, "QuerySetData", szQuery);
formatex( szQuery, 999, "UPDATE `matches` SET `MVP_steamid` = '%s', `MLP_steamid` = '%s' WHERE match_id = '%s';", MVPsteamid, MLPsteamid, szLine);
log_amx(szQuery)
SQL_ThreadQuery( g_hTuple, "QuerySetData", szQuery);
Here's an example for the mistake:
PHP Code:
formatex( szQuery, 999, "hello!" ); //szQuery is now 'hello!'
formatex( szQuery, 999, "good morning!" ); //szQuery is now 'good morning!'
formatex( szQuery, 999, "good night!" ); //szQuery is now 'good night!'
log_amx( szQuery ); //'good night!' logged
|
Ok really weird. Not working + 1 syntax, not code. I tried like that:
PHP Code:
formatex( szQuery, 999, "UPDATE `users` SET `MVP` = '1' WHERE steam_id = '%s';", MVPsteamid);
SQL_ThreadQuery( g_hTuple, "QuerySetData", szQuery);
formatex( szQuery, 999, "UPDATE `users` SET `MLP` = '1' WHERE steam_id = '%s';", MLPsteamid);
SQL_ThreadQuery( g_hTuple, "QuerySetData", szQuery);
formatex( szQuery, 999, "UPDATE `matches` SET `MVP_steamid` = '%s', `MLP_steamid` = '%s' WHERE match_id = '%s';", MVPsteamid, MLPsteamid, szLine);
SQL_ThreadQuery( g_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:
formatex( szQuery, 999, "UPDATE `users` SET MLP = MLP + 1 WHERE steam_id = '%s';", MLPsteamid);
|
|