SA-MP Forums Archive
Dead Connection MySQL - 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: Dead Connection MySQL (/showthread.php?tid=521547)



Dead Connection MySQL - .EnjatsRed. - 23.06.2014

I'm having a problem with MySQL, I'm trying to check if the player has an account with this:

Код:
if (RegistrationStep[playerid] == 0 && gPlayerLogged[playerid] != 1)
	{
		new query[128];
        format(query, sizeof(query), "SELECT Level FROM players WHERE username = '%s'", playerName(playerid));
		if (mysql_num_rows() == 0)
		{
			gPlayerAccount[playerid] = 0;
 			new regstring[128];
			new regname[64];
			GetPlayerName(playerid,regname,sizeof(regname));
			format(regstring,sizeof(regstring),"{FFFFFF}• Bun venit, "#COL_RED2"%s\n• {FFFFFF}Nu ai cont.\n• Te rog sa te inregistrezi:",regname);
			ShowPlayerDialog(playerid,12345,DIALOG_STYLE_PASSWORD,"Register",regstring,"Register","Exit");
		}
		else
		{
			new loginstring[128];
			new loginname[64];
			GetPlayerName(playerid,loginname,sizeof(loginname));
			format(loginstring,sizeof(loginstring),"{FFFFFF}• Bine ai venit, "#COL_RED2"%s\n• {FFFFFF}Acest nume este inregistrat.\n• Poti sa te loghezi:",loginname);
			ShowPlayerDialog(playerid,12346,DIALOG_STYLE_PASSWORD,"Login",loginstring,"Login","Exit");
		}
	}
And I get this:

Код:
CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)



Re: Dead Connection MySQL - Vince - 23.06.2014

So, where do you actually send your query?


Re: Dead Connection MySQL - .EnjatsRed. - 23.06.2014

You got me bro, I'm retarded.

I didn't noticed. Thanks!