28.06.2016, 15:57
Why don't you just join the two tables to get the player's name? Moreover consider using threaded queries:
pawn Код:
mysql_tquery(SQL, "SELECT a.Userid,IFNULL(u.username,\"\"),Date FROM aplicatii a LEFT JOIN users u ON u.id=a.Userid;", "OnAplicatiiLoadForPlayer", "i", playerid);
PHP код:
forward OnAplicatiiLoadForPlayer(playerid);
public OnAplicatiiLoadForPlayer(playerid)
{
new
tmp_userid,
tmp_date[32]; // change accordingly, 256 is way too much
szDialog2[0] = EOS; // reset the string, we don't want any text previously stored
for (new i, j = cache_get_row_count(); i != j; i++)
{
// rowid 0 = Userid | rowid 1 = username | rowid 2 = Date
tmp_userid = cache_get_row_int(i, 0);
cache_get_row(i, 1, szDialog);
cache_get_row(i, 2, tmp_date);
format(szDialog, sizeof szDialog, "%s\t%s\n", szDialog, tmp_date);
strcat(szDialog2, szDialog);
Selected[playerid][i] = tmp_userid;
}
}