SA-MP Forums Archive
mysql doesnt save - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: mysql doesnt save (/showthread.php?tid=204972)



mysql doesnt save - aircombat - 30.12.2010

Код:
dcmd_register(playerid, params[]) 
{
	new pName[MAX_PLAYER_NAME];
	GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
	new Escpname[24];
       GetPlayerName(playerid, pName, 24);
       mysql_real_escape_string(pName, Escpname);
	new password[128];
	new Query[128];
	format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `username` = '%s'",Escpname);
	mysql_query(Query);
	mysql_store_result();
	if(mysql_num_rows()) return SendClientMessage(playerid,COLOR_TEST,"This Account Is Already Registered");
	else if(sscanf(params,"s",password)) return SendClientMessage(playerid,COLOR_TEST,"Usage: /register [Password]");
	else
	{
		new string[128],string2[128];
		format(string, sizeof(string), "INSERT INTO `users` (`username`, `password`, `score`, `money`, `kills`, `deaths`, `warns`) VALUES ('%s', '%s', 0, 0, 0, 0, 0)", Escpname, password);
  		mysql_query(string);
		format(string2,128,"You're Now Registered , Password: %s",password);
		SendClientMessage(playerid,COLOR_TEST,string2);
	}
	return 1;
}
for some reason it doesnt save into the database :S


Re: mysql doesnt save - [L3th4l] - 30.12.2010

Umm, you sure you have the DB setup correctly? Turn on the MySQL logging, and post the logs here.