Wrong Function, dont work mysql
#1

Hi, i create this function but it doesnt works for mee.. dont store the result in a variable

Код:
public MysqlCargarDato(playerid, var[])
{
	new variable[128];
	new query[128];
	new pnombre[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pnombre, sizeof(pnombre));
	format(query, sizeof(query), "SELECT %s FROM `jugadores` WHERE nombre='%s'", var, pnombre);
	format(variable, sizeof(variable), "pinfo[playerid][%s]", var);
    mysql_query(query);
    mysql_store_result();
    mysql_fetch_row(variable);
    mysql_free_result();
}
Is there something wrong?
Reply
#2

You can't save it like this. You have to do for exmple:

pawn Код:
public MysqlCargarDato(playerid, var[])
{
    new variable[128];
    new query[128];
    new pnombre[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pnombre, sizeof(pnombre));
    format(query, sizeof(query), "SELECT %s FROM `jugadores` WHERE nombre='%s'", var, pnombre);
    mysql_query(query);
    mysql_store_result();
    mysql_fetch_row(variable);
    mysql_free_result();
    if(strcmp(var, "pLevel", true) == 0)
    {
        pinfo[playerid][pLevel] = strval(variable);
    }
}
Reply
#3

Thxx it workss !!.. now the problem its works with numbers 1,2,3,4,5 but when i usee that with letter! "abcde" dont works
Reply
#4

Please help me, i need to use this function with floats and letters ):
Reply
#5

Plsss i need that!!
Reply
#6

Quote:
Originally Posted by Zafire1410
Посмотреть сообщение
Please help me, i need to use this function with floats and letters ):
You can use floatstr(string); to convert the string to a float, use the way he made it convert from a string to an integer using strval(string); as an example to do it for floats.
Reply
#7

thxx now i use floatstr foor floats and strval for numbers.. but for letters what i use?
Reply
#8

If somone still want to know what to use for letters: strmid
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)