SA-MP Forums Archive
Issue with mysql query that gets cut out - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Issue with mysql query that gets cut out (/showthread.php?tid=621267)



Issue with mysql query that gets cut out - justjamie - 08.11.2016

Hello.
My query gets cut out.

code:
PHP код:
forward SetLeader(ffID,target,playerid);
public 
SetLeader(ffID,target,playerid)
{
    new 
string[400];
    
myStrcpy(Player[target][FactionRank],"New Leader");
    new 
query[400];
    
Player[target][Leader] = 1;
    
format(query,sizeof(query),"UPDATE accounts SET FactionRank='New Leader',IsLeader='1' WHERE Username='%s'",Player[target][Faction],Player[target][FactionName],Name(target));
    
mysql_tquery(connection,query,"");
    for(new 
0GetPlayerPoolSize(); <= ji++)
    {
        if(
Player[i][Faction] == ffID)
        {
            
format(string,sizeof(string),"{40FF00}[{BEF781}%s{40FF00}] Administrator {BEF781}%s{40FF00} has set {BEF781}%s{40FF00} as a faction leader.",Player[i][FactionName],RPName(playerid),RPName(target));
            
SendMessage(i,0xFF00FF,string);
        }
    }
    return 
1;

What my mysql log emits:
Код:
[11:38:29] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE accounts SET FactionRank='New Leader',IsLeader='1' WHERE ", callback: "(null)", format: "(null)"



Re: Issue with mysql query that gets cut out - oMa37 - 08.11.2016

mysql log does not print the whole format.
If there is something wrong with the query, it will print it in a tag either "[WARNING]" or "[ERROR]".
It's not a problem.


Re: Issue with mysql query that gets cut out - justjamie - 08.11.2016

Quote:
Originally Posted by oMa37
Посмотреть сообщение
mysql log does not print the whole format.
If there is something wrong with the query, it will print it in a tag either "[WARNING]" or "[ERROR]".
It's not a problem.
but it also doesn't update in the database so wtf?


Re: Issue with mysql query that gets cut out - Mencent - 08.11.2016

You have more parameters in format as %s, %i, %d or %f.
PHP код:
format(query,sizeof(query),"UPDATE accounts SET FactionRank='New Leader',IsLeader='1' WHERE Username='%s'",Player[target][Faction],Player[target][FactionName],Name(target)); 
You have one times %s, but you have three parameters.
I hope you know what I mean.


Re: Issue with mysql query that gets cut out - justjamie - 08.11.2016

Quote:
Originally Posted by Mencent
Посмотреть сообщение
You have more parameters in format as %s, %i, %d or %f.
PHP код:
format(query,sizeof(query),"UPDATE accounts SET FactionRank='New Leader',IsLeader='1' WHERE Username='%s'",Player[target][Faction],Player[target][FactionName],Name(target)); 
You have one times %s, but you have three parameters.
I hope you know what I mean.
omfg im so retarded

thanks