Issues with MySQL
#1

Alright; Heres the problem: When people try to log in, It either says their account is registered when its not. Or unregistered when it is. And when you try to log in when your registered with the CORRECT PASSWORD; it deny's it saying its invalid. The code is:

Код:
stock MySQL_NameExists(const account[])
{
	new szQuery[128], iRows = 0;
	mysql_format(gConnectionHandle, szQuery, "SELECT `Username` FROM `accounts` WHERE `Username` = '%s'", account);
	mysql_function_query(gConnectionHandle, szQuery, false, "OnQueryFinish", "siii", szQuery, 0, 0, gConnectionHandle);
	mysql_store_result();
	if(mysql_num_rows()) iRows = 1;
	else iRows = 0;
	mysql_free_result();
	return iRows;
}

stock MySQL_UpdateFieldInt(const account[], const fieldname[], iValue)
{
	new query[512];
	format(query, sizeof(query), "UPDATE `accounts` SET `%s` = '%d' WHERE `Username` = '%s'", fieldname, iValue, account);
	//mysql_query(query, -1, -1, 1);
	mysql_function_query(gConnectionHandle, query, true, "OnQueryFinish", "");
	return 1;
}

stock MySQL_UpdateFieldFloat(const account[], const fieldname[], Float:iValue)
{
	new query[512];
	format(query, sizeof(query), "UPDATE `accounts` SET `%s` = '%f' WHERE `Username` = '%s'", fieldname, iValue, account);
	//mysql_query(query, -1, -1, 1);
	mysql_function_query(gConnectionHandle, query, true, "OnQueryFinish", "");
	return 1;
}

stock MySQL_UpdateFieldString(const account[], const fieldname[], szValue[])
{
	new query[512];
	format(query, sizeof(query), "UPDATE `accounts` SET `%s` = '%s' WHERE `Username` = '%s'", fieldname, szValue, account);
	//mysql_query(query, -1, -1, 1);
	mysql_function_query(gConnectionHandle, query, true, "OnQueryFinish", "");
	return 1;
}

stock MySQL_GetAccountField(const account[], const fieldname[], destination[])
{
	new query[128];
	format(query, sizeof(query), "SELECT `%s` FROM `accounts` WHERE `Username` = '%s'", fieldname, account);
	//mysql_query(query, -1, -1, 1);
	mysql_function_query(gConnectionHandle, query, true, "OnQueryFinish", "");
	mysql_store_result();
	mysql_retrieve_row();
	mysql_fetch_field_row(destination, fieldname);
	mysql_free_result();
	return 1;
}

stock MySQL_GetAccountInt(const account[], const fieldname[])
{
	new destination[128];
	MySQL_GetAccountField(account, fieldname, destination);
	return strval(destination);
}

stock Float:MySQL_GetAccountFloat(const account[], const fieldname[])
{
	new destination[128];
	MySQL_GetAccountField(account, fieldname, destination);
	return floatstr(destination);
}
Hopefully I can get the problem script ._.

My script also uses DCMD; if this helps any...

The MySQL Database is correctly done.


Edit:

More Issues:

C:\Program Files (x86)\Rockstar Games\GTA San Andreas\SGRPSQL\Shadow Gaming Roleplay\gamemodes\sgrp.pwn(13888) : error 017: undefined symbol "password"
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\SGRPSQL\Shadow Gaming Roleplay\gamemodes\sgrp.pwn(13897) : error 017: undefined symbol "password"
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\SGRPSQL\Shadow Gaming Roleplay\gamemodes\sgrp.pwn(13897) : warning 215: expression has no effect
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\SGRPSQL\Shadow Gaming Roleplay\gamemodes\sgrp.pwn(13975) : error 017: undefined symbol "password"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

3 Errors.

Код:
	        strmid(password, inputtext, 0, strlen(inputtext), 255);
	        GetPlayerName(playerid, playername, sizeof(playername));
			/*if(strlen(playername) <= 2)
			{
	    		SendClientMessage(playerid, LIGHTRED, "Sorry, that name is too short, please change it.");
			   	Kick(playerid);
			   	return 1;
			}*/
			//Encrypt(password);
	         (playerid, password[]);
				}
        else
        {
            SendClientMessage(playerid, WHITE, "You have chosen to leave the server.");
	        Kick(playerid);
        }
    }
    if(dialogid == 2) //REGISTER
    {
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)