MySQL | Does not return the correct value
#1

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 =)
Reply
#2

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;
}
Reply
#3

i love you
thank you very much =)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)