Mysql update question, important.
#6

Maxips2 is right.

This would be more efficient than using the * wildcard
pawn Код:
format(query, sizeof(query), "SELECT `cash` FROM `users` WHERE `name` = '%s'", name);
mysql_function_query(dbHandle, query, true, "AddPlayerMoney", "si", name, cash);

The cache:
forward AddPlayerMoney(name[], cash);
public AddPlayerMoney(name[], cash)
{
    new rows, fields, query[128];
    cache_get_data(rows, fields);

    if(!rows) return 0;

    format(query, sizeof(query), "UPDATE `users` SET `cash` = %d WHERE `name` = '%s'", cash + cache_get_row_int(0, 0), name);
    mysql_function_query(dbHandle, query, true, "", "");
}
Also, in your first mysql_function_query, you had two i's, it should have been "si"
Reply


Messages In This Thread
Mysql update question, important. - by PaulDinam - 24.03.2013, 00:08
Re: Mysql update question, important. - by ReneG - 24.03.2013, 00:17
Re: Mysql update question, important. - by Maxips2 - 24.03.2013, 00:19
Re: Mysql update question, important. - by PaulDinam - 24.03.2013, 00:20
Re: Mysql update question, important. - by Maxips2 - 24.03.2013, 00:24
Re: Mysql update question, important. - by ReneG - 24.03.2013, 00:32

Forum Jump:


Users browsing this thread: 3 Guest(s)