SA-MP Forums Archive
issue in mysql problem - 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)
+--- Thread: issue in mysql problem (/showthread.php?tid=636314)



issue in mysql problem - HoussemGaming - 25.06.2017

Hello, i have this code
Код:
case DIALOG_WITHDRAW:
		{
			if(!response) return 1;
			if(response)
			{
			new query[256],pname[MAX_PLAYER_NAME],rows;
			GetPlayerName(playerid, pname, sizeof(pname));
			format(query,sizeof(query), "SELECT * FROM users WHERE username = '%s'",pname);
			mysql_query(query);
			mysql_store_result();
			rows = mysql_num_rows();
			if(!rows)
			{
				SCM(playerid, RED, "You don't have an account in Bank");
				ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "H-Bank", "CreateAccount\nStats\nDeposit\nWithdraw", "OK", "Cancel");
				mysql_free_result();
				return 1;
			}
			if(rows == 1)
			{
				new value = strval(inputtext);
				new money[9];
				format(query, sizeof(query), "SELECT money FROM users WHERE username = '%s'", pname);
				mysql_query(query);
				mysql_fetch_field_row(money, "money");
				if(value > strval(money)) return SCM(playerid, RED, "You don't have that amount in your bank account");
				format(query, sizeof(query), "UPDATE users SET money = '-%i' WHERE username = '%s'", value, pname);
				mysql_query(query);
				GivePlayerMoney(playerid, value);
				return 1;
			}
			mysql_free_result();
			return 1;
			}
So when i go ingame to test it it says You don't have that amount in your bank account, but when i check MYSQL i have that amount.
could please help me ?.