mysql problem
#1

I passed gm on r39-3 and now when I enter the server on my new account I bag password press register and I say this name is already used .... Although the database it's empty ...

Код:
[13:50:06] [DEBUG] mysql_tquery - connection: 1, query: "", callback: "(null)", format: "(null)"
[13:50:06] [DEBUG] mysql_tquery - connection: 1, query: "", callback: "(null)", format: "(null)"
[13:50:06] [DEBUG] mysql_format - connection: 1, len: 100, format: "SELECT * FROM `players` WHERE `username`='%e';"
[13:50:06] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `players` WHERE `username`='Jimmi';", callback: "OnLoadPlayer", format: "i"
[13:50:06] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[13:50:06] [ERROR] CMySQLQuery::Execute[] - (error #1065) Query was empty
[13:50:06] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError
[13:50:06] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[13:50:06] [ERROR] CMySQLQuery::Execute[] - (error #1065) Query was empty
[13:50:06] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError
[13:50:06] [DEBUG] CMySQLQuery::Execute[OnLoadPlayer] - starting query execution
[13:50:06] [DEBUG] CMySQLQuery::Execute[OnLoadPlayer] - query was successfully executed within 35.160 milliseconds
[13:50:06] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[13:50:06] [DEBUG] Calling callback "OnLoadPlayer"..
[13:50:06] [DEBUG] cache_get_row_count - connection: 1
[13:50:06] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[13:50:14] [DEBUG] mysql_format - connection: 1, len: 256, format: " SELECT `id` from `players` WHERE `username` = '%e' LIMIT 1;"
[13:50:14] [DEBUG] mysql_query - connection: 1, query: " SELECT `id` from `players` WHERE `username` = 'Jimmi' LIMIT 1;", use_cache: true
[13:50:14] [DEBUG] CMySQLQuery::Execute - starting query execution
[13:50:14] [DEBUG] CMySQLQuery::Execute - query was successfully executed within 11.751 milliseconds
[13:50:14] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[13:50:14] [DEBUG] CMySQLHandle::SaveActiveResult - cache saved (id: 51)
[13:50:14] [DEBUG] cache_get_row_count - connection: 1
[13:50:14] [DEBUG] cache_delete - cache_id: 51, connection: 1
[13:50:14] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[13:50:14] [DEBUG] CMySQLHandle::DeleteSavedResult - result deleted
Код:
forward MySQLCheckAccount(sqlplayersname[]);
public MySQLCheckAccount(sqlplayersname[])
{
	new query[ 256 ];
	mysql_format( handle, query, sizeof( query ), " SELECT `id` from `players` WHERE `username` = '%e' LIMIT 1;", sqlplayersname );
	new Cache:r = mysql_query( handle, query );
	if( !cache_num_rows() ) return 0,cache_delete( r );
	else
	{
		return cache_get_field_content_int( 0, "id" ),cache_delete( r );
	}
}
and
Код HTML:
if(dialogid == 12345)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(!response)
            {
                SendClientMessage(playerid, COLOR_WHITE, "{0066FF}Info: {FFFFFF}Ai fost dat afara pentru ca nu ai acceptat inregistrarea.");
                Kick(playerid);
                return 1;
            }
		    if(strlen(inputtext) >= 4 && strlen(inputtext) <= 70)
		    {
				GetPlayerName(playerid, sendername, sizeof(sendername));
				new sqlaccountexists = MySQLCheckAccount(sendername);
				if (sqlaccountexists != 0)
				{
				    SendClientMessage(playerid, COLOR_WHITE, " ");
				    SendClientMessage(playerid, COLOR_WHITE, "{0066FF}Info: {FFFFFF}Acel nume este deja folosit, alege altul.");
					return 1;
				}
				new tmppass[64];
    			mysql_real_escape_string(inputtext, tmppass);
       			if(strlen(tmppass) < 4)
     		    {
     		        new loginname[64];
					GetPlayerName(playerid,loginname,sizeof(loginname));
					ShowPlayerDialog(playerid,12347,DIALOG_STYLE_PASSWORD,"{FFFFFF}Logare","{FFFFFF}Scrie {0066FF}parola contului tau {FFFFFF}mai jos:","Logare","Iesi");
					gPlayerLogTries[playerid] += 1;
					if(gPlayerLogTries[playerid] == 5) { Kick(playerid); }
				}
				OnPlayerRegister(playerid,tmppass);
			}
			else
			{
				new regname[64];
				GetPlayerName(playerid,regname,sizeof(regname));
				ShowPlayerDialog(playerid,12347,DIALOG_STYLE_PASSWORD,"{FFFFFF}Inregistrare","{FFFFFF}Scrie {0066FF}parola contului tau {FFFFFF}mai jos:","Inregistrare","Iesi");
			}
		}
	}
Reply
#2

up?
Reply
#3

?
Reply
#4

Quote:
Originally Posted by jlalt
Посмотреть сообщение
download mysql r5 or r6 or r7 and check which will match.
https://sampforum.blast.hk/showthread.php?tid=56564
Try
Reply
#5

Try this out
pawn Код:
if(dialogid == 12345)
    {
        if(!IsPlayerConnected(playerid)) return 1;
        if(!response) return SendClientMessage(playerid, COLOR_WHITE, "{0066FF}Info: {FFFFFF}Ai fost dat afara pentru ca nu ai acceptat inregistrarea."), Kick(playerid), 1;
        if(strlen(inputtext) < 4 || strlen(inputtext) > 70) return ShowPlayerDialog(playerid,12347,DIALOG_STYLE_PASSWORD,"{FFFFFF}Inregistrare","{FFFFFF}Scrie {0066FF}parola contului tau {FFFFFF}mai jos:","Inregistrare","Iesi");

        new name[MAX_PLAYER_MAME];
        GetPlayerName(playerid, name, sizeof(name));
        if(MySQLCheckAccount(name) != -1) return SendClientMessage(playerid, COLOR_WHITE, " "), SendClientMessage(playerid, COLOR_WHITE, "{0066FF}Info: {FFFFFF}Acel nume este deja folosit, alege altul.");

        new tmppass[64];
        mysql_real_escape_string(inputtext, tmppass);
        if(strlen(tmppass) < 4)
        {
            ShowPlayerDialog(playerid,12347,DIALOG_STYLE_PASSWORD,"{FFFFFF}Logare","{FFFFFF}Scrie {0066FF}parola contului tau {FFFFFF}mai jos:","Logare","Iesi");

            if(++gPlayerLogTries[playerid] >= 5) return Kick(playerid);
        }
        OnPlayerRegister(playerid, tmppass);
    }
   
forward MySQLCheckAccount(sqlplayersname[]);
public MySQLCheckAccount(sqlplayersname[])
{
    new query[ 256 ];
    mysql_format( handle, query, sizeof( query ), "SELECT `id` from `players` WHERE `username` = '%e' LIMIT 1;", sqlplayersname );
    new Cache:r = mysql_query( handle, query );

    new value;
    if( !cache_num_rows() ) value = -1;
    else value = cache_get_field_content_int( 0, "id" );
    cache_delete(r);
    return value;
}
Also it looks like you're calling empity queries at some point, you should find and stop calling them.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)