09.10.2016, 12:43
hi.i have a database and table and it has id , ip , aka , how can i get all rows with same ip with easy-mysql and then get aka?
if(SQL::RowExistsEx("mrp_aka","ip",PlayerIp(playerid))) { while(handle=SQL::OpenEx(SQL::READ,"mrp_aka","ip",PlayerName(playerid))) { new str[256];SQL::ReadString(handle,"ip",str);print(str); } }
public recentlyUsedNicks(playerid)
{
new query[200], ip[16], pName[24],pName1[10][24], playerName[24];
GetPlayerIp(playerid, ip, sizeof(ip));
GetPlayerName(playerid, playerName, sizeof(playerName));
mysql_format(1, query, sizeof(query),"SELECT playerName FROM `playerdata` WHERE `playerIP`='%s' LIMIT 10", ip);
new Cache:cacheid = mysql_query(1, query);
new rows = cache_num_rows();
new string[128];//, string1[128];
if(rows > 1)
{
format(string, sizeof(string),"Player %s has previously connected with following %d names:", playerName, rows);
// adminchat(COLOR_GREEN, string);
for(new i = 0; i < rows; i++)
{
cache_get_field_content(i, "playerName", pName, 1, 50);
pName1[i] = pName;
format(string, sizeof(string),"%s \n%s",string, pName1[i]);
}
adminchat(COLOR_GREEN, string);
IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
}
cache_delete(cacheid);
}
public recentlyUsedNicks(playerid) { static query[ 84 ], ip[ 16 ], pName[ 24 ], playerName[ 24 ] ; GetPlayerIp( playerid, ip, sizeof( ip ) ); GetPlayerName( playerid, playerName, sizeof( playerName ) ); mysql_format( 1, query, sizeof( query ),"SELECT `playerName` FROM `playerdata` WHERE `playerIP` = '%s' LIMIT 10", ip ); new Cache:cacheid = mysql_query( 1, query ), rows = cache_num_rows(), string[ 256 ] ; if( rows ) { format( string, sizeof( string ),"Player %s has previously connected with following %d names:", playerName, rows ); for( new i = 0; i < rows; i++ ) { cache_get_field_content( i, "playerName", pName, 1, sizeof( pName ) ); format( string, sizeof( string ),"%s\n%s", string, pName ); } adminchat( COLOR_GREEN, string ); IRC_GroupSay( gGroupID, IRC_CHANNEL, string ); } cache_delete(cacheid); // Your deleting the cache right after saving it? This makes it pointless to cache }