08.10.2012, 18:29
Hello,Do you know how to count Mysql r7 with return? How get value from the callback function of mysql and after return in the general function.
stock fetchCount(playerid)
{
mysql_function_query(handle, "SELECT COUNT(*) FROM `table`", true, "OnCountRetrieve", "i", playerid);
return 1;
}
forward OnCountRetrieve(playerid);
public OnCountRetrieve(playerid)
{
new content[10];
cache_get_field_content(0, "COUNT(*)", content, handle);
new string[128];
format(string, sizeof(string), "The table has %d rows inside it.", strval(content));
SendClientMessage(playerid, -1, string);
return 1;
}