MySQL returns wrong field?!
#1

Hey guys, i got a problem with MySQL.

I have a stock which returns the password of a user and that works fine:
Code:
stock mysql_ReturnPasswort(Name[])
{
    new query[130], Get[130];
    mysql_real_escape_string(Name, Name);
    format(query, 128, "SELECT `passwort` FROM `accounts` WHERE `Name` = '%s'", Name);
    mysql_query(query);
    mysql_store_result();
    mysql_fetch_row(Get);
    mysql_free_result();
    return Get;
}
But my problem is the stock which should return an Integer of a Field:

Code:
stock mysql_GetInt(Table[], Field[], Where[], Is[])
{
	new sqlint;
    new query[128];
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(Where, Where);
    mysql_real_escape_string(Is, Is);
    format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", Field, Table, Where, Is);
    mysql_query(query);
    mysql_store_result();
    sqlint = mysql_fetch_int(connection);
    mysql_free_result();
    return sqlint;
}
It gets called like this when a user login (for debugging):

printf("%s",mysql_GetInt("accounts", "Money", "Name", PlayerName(playerid)));

But in the log it just says "sqltest1" (thats a part from the password of the user, the full pw is "mysqltest1")

Why does it return a part of the password and not the integer from the right field?
Can someone help me? I use the mysql plugin by Strickenkid

greetz!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)