SA-MP Forums Archive
MySQL | Does not return the correct value - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MySQL | Does not return the correct value (/showthread.php?tid=263826)



MySQL | Does not return the correct value - EviLpRo - 23.06.2011

Hello!

I have this code:

pawn Код:
if(strcmp(cmdtext,"/Value",true)==0)
{
    new s_return[256];
    mysql_query("SELECT 'Weapon1Money' FROM 'SERVER'");
    mysql_store_result();
     mysql_fetch_row_format(s_return,"|");
    mysql_free_result( );
    format(String,256,"%d",strval(s_return) );
        SendClientMessage(playerid,c_red,String);
    return 1;
}
But the thing I'm doing this command does not return the correct value exists in the table.
If someone can get me a revised code, I already understand the code and learn what's the problem.

Thanks in advance helpers =)


Re: MySQL | Does not return the correct value - gimini - 23.06.2011

pawn Код:
if(strcmp(cmdtext,"/Value",true)==0)
{
    mysql_query("SELECT `Weapon1Money` FROM `SERVER`");
    mysql_store_result();
    if(mysql_retrieve_row() == 1)
    {
      new buffer[10];
      mysql_fetch_field_row(buffer, "Weapon1Money");
      new value = strval(buffer);
      format(buffer, sizeof(buffer),"%d", value);
      SendClientMessage(playerid, c_red, buffer);
    }
    mysql_free_result();
    return 1;
}



Re: MySQL | Does not return the correct value - EviLpRo - 23.06.2011

i love you
thank you very much =)