Little help with getarg(mysql)
#1

I've done something wrong:
pawn Code:
//MLog(playerid,"Whispered","s",text);
stock MLog(playerid,action[],formats[], {Float,_}:...)
{
    if(!IsPlayerConnected(playerid)) return 0;
    new
        paramCount = numargs(),
        lenght=strlen(formats),
        query[500],
        argstring[200];
    if((paramCount-3) != lenght) return printf("ERROR! Arg count is not equal to the format!");

    for(new i; i < lenght;i++)
    {
        switch(formats[i])
        {
            case 's': format(argstring,sizeof(argstring),"%s %s",argstring,getarg(i+3));
            case 'i': format(argstring,sizeof(argstring),"%s %i",argstring,getarg(i+3));
            case 'd': format(argstring,sizeof(argstring),"%s %d",argstring,getarg(i+3));
            case 'f': format(argstring,sizeof(argstring),"%s %.1f",argstring,getarg(i+3));
            case 'c': format(argstring,sizeof(argstring),"%s %c",argstring,getarg(i+3));
            default: format(argstring,sizeof(argstring),"%s %s",argstring,getarg(i+3));
        }
    }
    mysql_real_escape_string(argstring,argstring);
    format(query,sizeof(query),"INSERT INTO `Logs` (`PName`, `Action`, `Variable`, `Date`) VALUES ('%s', '%s', '%s', NOW())",ReturnName(playerid),action,argstring);
    return mysql_query(query);
}
So, the Variable(argstring) doesn't show up in mysql correctly. Instead, it shows up with some previously used strings. For example part of the dialog name.
Edit: Forgot to mention, this problem is only with strings.
Reply


Messages In This Thread
Little help with getarg(mysql) - by wups - 25.09.2011, 12:30
Re: Little help with getarg(mysql) - by Stylock - 25.09.2011, 13:27
Re: Little help with getarg(mysql) - by wups - 25.09.2011, 16:52
AW: Little help with getarg(mysql) - by Meta - 25.09.2011, 17:16

Forum Jump:


Users browsing this thread: 2 Guest(s)