Why the output returns -1 ?
#2

pawn Код:
stock mysql_Int(db[],fl[],input[])
{
    new query[256],Result[256],value[11]; //value is an integer so it doesnt have to be a large string.
    format(query,sizeof(query),"SELECT %s FROM %s WHERE %s",fl,db,input);
    samp_mysql_query(query);
    samp_mysql_store_result();
    if(samp_mysql_fetch_row(Result)==1)
    {
        samp_mysql_strtok(value,"|",Result);
        new output=strval(value);
        return output;
    }
    return 0;
}
Remove the output from the function line, no need for it. Tokenize it, grab the integer, return it. So it can return 100, 5, 26, or 1. Any integer up to 11 digits long. so 10000000000 is an 11 length integer. Now this should work. Now use:
pawn Код:
playerinfo[playerid][uid] = mysql_Int("users","id",string);
Reply


Messages In This Thread
Why the output returns -1 ? - by gijsmin - 09.04.2009, 18:08
Re: Why the output returns -1 ? - by tom_jonez - 09.04.2009, 19:28
Re: Why the output returns -1 ? - by gijsmin - 09.04.2009, 19:38
Re: Why the output returns -1 ? - by tom_jonez - 09.04.2009, 19:59
Re: Why the output returns -1 ? - by gijsmin - 09.04.2009, 20:03
Re: Why the output returns -1 ? - by tom_jonez - 09.04.2009, 20:17
Re: Why the output returns -1 ? - by gijsmin - 09.04.2009, 21:52

Forum Jump:


Users browsing this thread: 2 Guest(s)