MySQL returning multiple rows
#1

Hello, guys! I'm having some trouble loading multiple rows from database. For example I want to select and store the users with same IP, this is what i've done so far but no result:

Код:
if(strcmp(cmd, "/trackip", true) == 0)
	{
	    if(AdminSecurity[playerid] == 0) return SEM(playerid);
    	tmp = strtok(cmdtext, idx);
    	new qwe[128],zxc[128], string11[256];
    	format(qwe, sizeof(qwe), "%s",tmp);
		format(string11, sizeof(string11), "SELECT IP,username,LastON FROM players WHERE IP = '%s'", qwe);
		mysql_query(string11);
		mysql_store_result();
        new rows = mysql_num_rows();
        mysql_free_result();
        while(mysql_retrieve_row())
        {
            new infoq[3][64];
            mysql_fetch_field_row(zxc, "username"); format(infoq[0], 64, zxc);
        	mysql_fetch_field_row(zxc, "IP"); format(infoq[1], 64, zxc);
        	mysql_fetch_field_row(zxc, "LastON"); format(infoq[2], 64, zxc);
        	format(string, sizeof(string), "Player %s, last logged on %s, IP: %s.", infoq[0], infoq[2], infoq[1]);
        	SCM(playerid, COLOR_WHITE, string);
        	idx++;
		}
	}
Reply


Messages In This Thread
MySQL returning multiple rows - by .EnjatsRed. - 06.08.2014, 16:42
Re: MySQL returning multiple rows - by paulommu - 06.08.2014, 16:47
Re: MySQL returning multiple rows - by .EnjatsRed. - 06.08.2014, 17:15

Forum Jump:


Users browsing this thread: 1 Guest(s)