#1

All the codes is fine and is good and it was working when i added cookie system i removed all players data then

I go game to register and when i relog it say register and when i took a look on php my admin when i register it doesn't save the account in the Database

Codes :
Код:
public OnAccountRegister(playerid)
{
    pData[playerid][ID] = cache_insert_id(); //loads the ID of the player in the variable once they registered.
    printf("New account registered. ID: %d", pData[playerid][ID]); //just for debugging.
    pData[playerid][Money] = 50000;
    GivePlayerMoney(playerid, 50000);
    return 1;
}

public OnAccountLoad(playerid)
{
	new score,string[143];
 	pData[playerid][Admin] = cache_get_field_content_int(0, "Admin"); //we're getting a field 4 from row 0. And since it's an integer, we use cache_get_row_int
 	pData[playerid][VIP] = cache_get_field_content_int(0, "VIP"); //Above
 	pData[playerid][Money] = cache_get_field_content_int(0, "Money");//Above
 	pData[playerid][Kills] = cache_get_field_content_int(0,"Kills");
 	pData[playerid][Cookies] = cache_get_field_content_int(0,"Cookies");
 	pData[playerid][Cakes] = cache_get_field_content_int(0,"Cakes");
 	pData[playerid][Icecream] = cache_get_field_content_int(0,"Icecream");
 	pData[playerid][Deaths] = cache_get_field_content_int(0, "Deaths");
 	score = cache_get_field_content_int(0, "Score");
 	pData[playerid][Money] = cache_get_field_content_int(0, "Money");

 	SetPlayerScore(playerid, score);
 	GivePlayerMoney(playerid, pData[playerid][Money]);//Let's set their money
 	//For player's position, set it once they spawn(OnPlayerSpawn)
	format(string,sizeof(string),"* Login Successful... Welcome Back to XtremeX %s",GetName(playerid)); //tell them that they have successfully logged in
	return 1;
}
public AutoLogin(playerid)
{
	new score,String[134];
 	pData[playerid][Admin] = cache_get_field_content_int(0, "Admin"); //we're getting a field 4 from row 0. And since it's an integer, we use cache_get_row_int
 	pData[playerid][VIP] = cache_get_field_content_int(0, "VIP"); //Above
 	pData[playerid][Money] = cache_get_field_content_int(0, "Money");//Above
 	pData[playerid][Kills] = cache_get_field_content_int(0,"Kills");
 	pData[playerid][Cookies] = cache_get_field_content_int(0,"Cookies");
 	pData[playerid][Cakes] = cache_get_field_content_int(0,"Cakes");
 	pData[playerid][Icecream] = cache_get_field_content_int(0,"Icecream");
 	pData[playerid][Deaths] = cache_get_field_content_int(0, "Deaths");
 	score = cache_get_field_content_int(0, "Score");
 	pData[playerid][Money] = cache_get_field_content_int(0, "Money");

 	SetPlayerScore(playerid, score);
 	GivePlayerMoney(playerid, pData[playerid][Money]);//Let's set their money
 	//For player's position, set it once they spawn(OnPlayerSpawn)
 	format(String,sizeof(String),"* Auto-IP Login Successful... Welcome back to XtremeX %s!",GetName(playerid));
	SendClientMessage(playerid, 0x00FF0054, String); //tell them that they have successfully logged in
	return 1;
}
Mysql Log:

Код:
execution
[12:09:02] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - query was successfully executed within 0.424 milliseconds
[12:09:02] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[12:09:02] [DEBUG] Calling callback "OnAccountCheck"..
[12:09:02] [DEBUG] cache_get_data - connection: 1
[12:09:02] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[12:09:11] [DEBUG] mysql_format - connection: 1, len: 300, format: "INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `VIP`,`Kills`,`Cookies`,`Cakes`,`Icecream`,`Deaths`,`Score`, `Mone..."
[12:09:11] [ERROR] mysql_format - destination size is too small
[12:09:11] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `V", callback: "OnAccountRegister", format: "i"
[12:09:11] [DEBUG] CMySQLQuery::Execute[OnAccountRegister] - starting query execution
[12:09:11] [ERROR] CMySQLQuery::Execute[OnAccountRegister] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
[12:09:11] [DEBUG] CMySQLQuery::Execute[OnAccountRegister] - error will be triggered in OnQueryError
Reply
#2

Show us all codes of the MySQL system and also, your format size is small, increase it.

P.S: Mainly the saving part.
Reply
#3

The logs tells you exactly what is wrong and where:
Код:
[DEBUG] mysql_format - connection: 1, len: 300, format: "INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `VIP`,`Kills`,`Cookies`,`Cakes`,`Icecream`,`Deaths`,`Score`, `Mone..."
[ERROR] mysql_format - destination size is too small
Reply
#4

take a look here:
http://forum.sa-mp.com/showpost.php?...postcount=4602
and second thing:
mysql_format - destination size is too small
Reply
#5

Ok fixed that new errors:

Код:
[12:21:38] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[12:21:38] [DEBUG] Calling callback "OnAccountCheck"..
[12:21:38] [DEBUG] cache_get_data - connection: 1
[12:21:38] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[12:21:52] [DEBUG] mysql_format - connection: 1, len: 1300, format: "INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `VIP`,`Kills`,`Cookies`,`Cakes`,`Icecream`,`Deaths`,`Score`, `Mone..."
[12:21:52] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `V", callback: "OnAccountRegister", format: "i"
[12:21:52] [DEBUG] CMySQLQuery::Execute[OnAccountRegister] - starting query execution
[12:21:52] [ERROR] CMySQLQuery::Execute[OnAccountRegister] - (error #1136) Column count doesn't match value count at row 1
[12:21:52] [DEBUG] CMySQLQuery::Execute[OnAccountRegister] - error will be triggered in OnQueryError
Reply
#6

All what i use is tquery
Reply
#7

I'll assume that you've read the error message and just not understand it so I'll provide an example. But please, next time read the errors, try to understand or even ****** them. There are plenty of those out there.

Код:
[ERROR] CMySQLQuery::Execute[OnAccountRegister] - (error #1136) Column count doesn't match value count at row 1
Код:
INSERT INTO table (column1, column2) VALUES (value1, value2, value3);
2 column count
3 value count

Conclusion: they do not match - throws an error.
Reply
#8

Replace this:
PHP код:
mysql_format(mysqlquerysizeof(query), "INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `VIP`,`Kills`,`Cookies`,`Cakes`,`Icecream`,`Deaths`,`Score`, `Money`) VALUES ('%e', '%s', '%s', 0, 0, 0, 0, 0, 50000)"pName(playerid), pData[playerid][Password], IP[playerid]); 
with this:

PHP код:
mysql_format(mysqlquerysizeof(query), "INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `VIP`,`Kills`,`Cookies`,`Cakes`,`Icecream`,`Deaths`,`Score`, `Money`) VALUES ('%e', '%s', '%s', '0', '0', '0', '0', '0','0','0','0', '50000')"pName(playerid), pData[playerid][Password], IP[playerid]); 
Note: It can be found OnDialogResponse.

And also, never do this. This is a public forum. Don't PM me for help, just post it here.
Reply
#9

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
It looks like your string size is too small. Increase the size of query.
And make sure about this:
Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
"INSERT INTO table (column1, column2) VALUES ('value1', 'value2', 'value3')"
As you can see in the example above, there are 2 columns and 3 values - like the error describes: "Column count doesn't match value count ..."
EDIT:Already Posted Konst faster :c
Reply
#10

Quote:
Originally Posted by AjaxM
Посмотреть сообщение
Replace this:
PHP код:
mysql_format(mysqlquerysizeof(query), "INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `VIP`,`Kills`,`Cookies`,`Cakes`,`Icecream`,`Deaths`,`Score`, `Money`) VALUES ('%e', '%s', '%s', 0, 0, 0, 0, 0, 50000)"pName(playerid), pData[playerid][Password], IP[playerid]); 
with this:

PHP код:
mysql_format(mysqlquerysizeof(query), "INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `VIP`,`Kills`,`Cookies`,`Cakes`,`Icecream`,`Deaths`,`Score`, `Money`) VALUES ('%e', '%s', '%s', '0', '0', '0', '0', '0','0','0','0', '50000')"pName(playerid), pData[playerid][Password], IP[playerid]); 
Note: It can be found OnDialogResponse.

And also, never do this. This is a public forum. Don't PM me for help, just post it here.
Thanks fixed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)