About mysql ,cant creat datebase.
#1

Код:
CMD:register(playerid, params[])
{
	if(pInfo[playerid][pLogged] == 1){return 1;}
	if(pHaveAcc[playerid] == 1){return 1;}
	if(isnull(params)){return SendClientMessage(playerid, COLOR_GREY, "Please num /register [password]");}
	new query[1024];
	new sqlusername[64];
	new sqlpassword[512];
	mysql_real_escape_string(GetName(playerid), sqlusername);
	mysql_real_escape_string(params, sqlpassword);
   	format(query, sizeof(query), "INSERT INTO `accounts` (name, password, skin, level, moneys, team, rank,\
	job, mats, drugs, driving, flying, sailling, weapons, health, armour, wanted, jailed, jailtime,\
	spawnx, spawny, spawnz, interior, weapon1, weapon2, weapon3, weapon4) VALUES ('%s', MD5('%s'),0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)", sqlusername,sqlpassword);
	mysql_query(query);
	pInfo[playerid][pLogged] = 1;
	SpawnPlayer(playerid);
	new string[128];
	format(string,sizeof(string),"%s you can login on!",GetName(playerid));
	SendClientMessage(playerid,COLOR_BLUE,string);
	return 1;
}
Hello guys, my cmd cant store or creat a accounts please help me .
Reply
#2

maybe create the table called "accounts" in the MySQL database?
Reply
#3

Quote:
Originally Posted by Max_Coldheart
Посмотреть сообщение
maybe create the table called "accounts" in the MySQL database?
yes i created yet .
Reply
#4

Have you checked MySQL logs for errors?
Reply
#5

Quote:
Originally Posted by Skorch
Посмотреть сообщение
Have you checked MySQL logs for errors?
Код:
[16:23:54]  

[16:23:54] ---------------------------

[16:23:54] MySQL Debugging activated (06/19/11)

[16:23:54] ---------------------------

[16:23:54]  

[16:24:18] >> mysql_query( Connection handle: 1 )

[16:24:18] CMySQLHandler::Query(SELECT * FROM `accounts` WHERE `name` = 'Vivian_Kris') - Successfully executed.

[16:24:18] >> mysql_store_result( Connection handle: 1 )

[16:24:18] CMySQLHandler::StoreResult() - Result was stored.

[16:24:18] >> mysql_free_result( Connection handle: 1 )

[16:24:18] CMySQLHandler::FreeResult() - Result was successfully free'd.

[16:24:18] >> mysql_num_rows( Connection handle: 1 )

[16:24:18] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)

[16:26:13] >> mysql_real_escape_string( Connection handle: 1 )

[16:26:13] CMySQLHandler::EscapeString(Vivian_Kris); - Escaped 11 characters to Vivian_Kris.

[16:26:13] >> mysql_real_escape_string( Connection handle: 1 )

[16:26:13] CMySQLHandler::EscapeString(luxingg); - Escaped 7 characters to luxingg.

[16:26:13] >> mysql_query( Connection handle: 1 )

[16:26:13] CMySQLHandler::Query(INSERT INTO `accounts` (`name`, `password`, `skin`, `level`, `moneys`, `team`, `rank`,`job`, `mats`, `drugs`, `driving`, `flying`, `sailling`, `weapons`, `health`, `armour`, `wanted`, `jailed`, `jailtime`,`spawnx`, `spawny`, `spawnz`, `interior`, `weapon1`, `weapon2, `weapon3`, `weapon4`) VALUES ('Vivian_Kris', MD5('luxingg'),'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0')) - An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'weapon3`, `weapon4`) VALUES ('Vivian_Kris', MD5('luxingg'),'0','0','0','0','0','' at line 1)
Reply
#6

someone can help me ?
Reply
#7

Your MySQL log: An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'weapon3`, `weapon4`) VALUES ('Vivian_Kris', MD5('luxingg'),'0','0','0','0','0','' at line 1).

You forgot to add ` after weapon2.
Reply
#8

Quote:
Originally Posted by Mr4rtur
Посмотреть сообщение
Your MySQL log: An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'weapon3`, `weapon4`) VALUES ('Vivian_Kris', MD5('luxingg'),'0','0','0','0','0','' at line 1).

You forgot to add ` after weapon2.
only one error due to DEAD CONNECTION ? very thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)