mysql_num_rows problem with mysql 2.1.1 version
#1



when i get this error
Код:
[MySQL] Error: Max connections (4) reached, could not connect.
my server just stop to work

Код:
stock IsPlayerRegistered(playername[])
{
   new szQuery[512];
   
   format(szQuery, sizeof(szQuery), "SELECT * FROM `users` WHERE `username` = '%s'", playername);
   SendQuery(szQuery);

   mysql_store_result();
	new regm = mysql_num_rows();
	if (!regm){
		return false;
	}
	mysql_free_result();
   return 1;
}



public OnPlayerRequestSpawn(playerid)
{
   if (IsPlayerRegistered(PlayerName(playerid)) && PlayerInfo[playerid][LoggedIn] == false)
   {
SendNSMessage(playerid, COLOR_RED, "This nickname is registered, you must login before spawning. (/ns login)");
   }else{
	  SendNSMessage(playerid, COLOR_RED, "You must create register first. (/ns register)");
   }

   return 1;
}
Why mysql_num_rows returns nothing and why I reach max_connections?
Reply
#2

Hi FasTLinE,

Could you please show me the code in which you use mysql_init and mysql_query?

From first glance it would seem as if you are creating too many mysql connections with mysql_init.
Reply
#3

Код:
public mysql_start()
{
    new MySQL:connection = mysql_init(0); //mysql_init(LOG_ONLY_ERRORS, 1)
   if (mysql_connect(DBHOST, DBUSER, DBPASS, DBNAME, connection, 1))
   {
      //mysql_debug(0);

	  print("[MYSQL] Connection successful!");
   }
   else
   {
	  print("[MYSQL] There was an error connecting to the MYSQL server");
   }

   return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)