mysql_num_rows problem with mysql 2.1.1 version - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: mysql_num_rows problem with mysql 2.1.1 version (
/showthread.php?tid=570676)
mysql_num_rows problem with mysql 2.1.1 version -
FasTLinE - 12.04.2015
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?
Re: mysql_num_rows problem with mysql 2.1.1 version -
MEW273 - 13.04.2015
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.
Re: mysql_num_rows problem with mysql 2.1.1 version -
FasTLinE - 13.04.2015
Код:
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;
}