MySQL problem
#6

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 icache_get_row_count(); != ji++)
    {
        
// rowid 0 = Userid | rowid 1 = username | rowid 2 = Date
        
tmp_userid cache_get_row_int(i0);
        
cache_get_row(i1szDialog); 
        
cache_get_row(i2tmp_date);
        
format(szDialogsizeof szDialog"%s\t%s\n"szDialogtmp_date);
        
strcat(szDialog2szDialog); 
        
Selected[playerid][i] = tmp_userid
    }

Reply


Messages In This Thread
MySQL problem - by Edw - 28.06.2016, 10:33
Re: MySQL problem - by Edw - 28.06.2016, 13:31
Re: MySQL problem - by SyS - 28.06.2016, 13:55
Re: MySQL problem - by Edw - 28.06.2016, 15:06
Re: MySQL problem - by Wantedboy21 - 28.06.2016, 15:42
Re: MySQL problem - by Konstantinos - 28.06.2016, 15:57

Forum Jump:


Users browsing this thread: 1 Guest(s)