(MySQL_NameExists(inputtext))
#1

Something weird is going on..
Each time I log onto my server, I can't register anymore, it keeps saying That name is already registered, but I've checked my MySql database and it's literally clear, I've tried many different names but still the same thing, all plugins loaded successfully, there's no errors when I compile, everything fine. It just automatically thinks every person who connects is registered, please help me.
Reply
#2

Well we can't help you without code, can we?
Reply
#3

I seriously don't know what part of my script I should actually show you..
but..

Код:
public OnQueryError(errorid, error[], resultid, extraid, callback[], query[], connectionHandle)
{
	new File:file = fopen("mysql_error_log.txt", io_append);
	if (file)
	{
	    new string[512], day, month, year, hour, minute, second;
	    gettime(hour, minute, second);
	    getdate(year, month, day);
	    format(string, sizeof(string), "[%02d/%02d/%02d %02d:%02d:%02d] Query error (errorid: %d, error: %s, callback: %s, connectionHandle: %d)\r\n", day, month, year, hour, minute, second, errorid, error, callback, connectionHandle);
		fwrite(file, string);
		fclose(file);
	}
	return 1;
}

stock MySQL_NameExists(const account[])
{
	new
	    szQuery[128],
		iRows = 0;

	format(szQuery, sizeof(szQuery), "SELECT `Username` FROM `accounts` WHERE `Username` = '%s'", account);
	mysql_query(szQuery);
	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);
	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);
	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);
	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);
	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);
}
Reply
#4

In MySQL_NameExists() try to get everything (*) and then check for rows.
Reply
#5

Quote:
Originally Posted by kamiliuxliuxliux
Посмотреть сообщение
In MySQL_NameExists() try to get everything (*) and then check for rows.
What do you mean by (*) sorry?
Reply
#6

SELECT * FROM ........ (* means everything)
Reply
#7

Код:
format(szQuery, sizeof(szQuery), "SELECT * FROM `accounts` WHERE `Username` = '%s'", account);
He means this.
Reply
#8

Dirigent00 and kamiliuxliuxliux thanks for your reply and support but I am still getting the same error, just to show the rest and hopyfully get it up and running again this is the error.

Quote:

error 025: function heading differs from prototype

According to the error, it is on line 3365 which reads the follow:

Quote:

public OnQueryError(errorid, error[], resultid, extraid, callback[], query[], connectionHandle)
{
new File:file = fopen("mysql_error_log.txt", io_append);
if (file)
{
new string[512], day, month, year, hour, minute, second;
gettime(hour, minute, second);
getdate(year, month, day);
format(string, sizeof(string), "[%02d/%02d/%02d %02d:%02d:%02d] Query error (errorid: %d, error: %s, callback: %s, connectionHandle: %d)\r\n", day, month, year, hour, minute, second, errorid, error, callback, connectionHandle);
fwrite(file, string);
fclose(file);
}
return 1;
}

stock MySQL_NameExists(const account[])
{
new
szQuery[128],
iRows = 0;

format(szQuery, sizeof(szQuery), "SELECT * FROM `accounts` WHERE `Username` = '%e'", account);
mysql_query(szQuery);
mysql_store_result();
if (mysql_num_rows())
{
iRows = 1;
}
else iRows = 0;
mysql_free_result();
return iRows;
}

This is what I see when I try to login... even if I have no account (Never registered an account). I am using a Linux hosting and it use to work on my localhosting. Picture below shows the ingame error:



Please HELP, I have been trying to figure this out all NIGHT.
Reply
#9

EDIT: Nevermind, got the wrong idea of solving it.
Reply
#10

That error means your callback is different from the prototype (forward and forward is created by default). I'm not sure, but as MySQL R33 says, try using OnQueryError(errorid, error[], callback[], query[], connectionHandle).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)