how to check?
#1

hi i wanna from mysql database check if player with specific ip is already registered in my database

Код HTML:
format(query,1024,"SELECT `Name1` FROM `ips` WHERE `IP` = '%s' LIMIT 1",PlayerName(playerid)); //check if name1 with that ip exist
			mysql_query(query);
			mysql_store_result();
			if(mysql_num_rows()== 0) // if name not exist - we insert
			{
			    format(query,256,"INSERT INTO `ips` (Name1, IP) VALUES ('%s','%s')",PlayerName(playerid), GetPlayerIpEx(playerid));
				mysql_query(query);
			}
			else if(mysql_num_rows()== 1) //if name1 with that ip exist we update our databese but this tame we update just name2
			{
			    format(query,512,"UPDATE `ips` SET `Name2` = '%s' WHERE (`IP` = '%s')",PlayerName(playerid), GetPlayerIpEx(playerid));
				mysql_query(query);
			}
			else if(mysql_num_rows()== 2) //but if name1 and name2 exist but player connect with third nick we kick him
			{
			    Kick(playerid);
   			}
so what iam doing wrong?
Reply


Messages In This Thread
how to check? - by speed258 - 19.02.2013, 09:54
Re: how to check? - by Roko_foko - 19.02.2013, 10:31

Forum Jump:


Users browsing this thread: 1 Guest(s)