Wrong Value in MySQL
#1

When i type an age in the dialog box, in the database it's everytime "49"

Код:
		case DIALOG_AGE:
		{
			if(!response)
			{
				if(pInfo[playerid][pLanguage] == 1) return ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Age", "Tasteaza varsta caracterului tau.", "Ok", "Close");
				if(pInfo[playerid][pLanguage] == 2) return ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Age", "Type your character age.", "Ok", "Close");
			}
			if(response)
			{
				if(!strlen(inputtext))
				{
					if(pInfo[playerid][pLanguage] == 1) return ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Age", "Tasteaza o varsta cuprinsa intre 13 si 80.\n\nTasteaza varsta caracterului tau.", "Ok", "Close");
					if(pInfo[playerid][pLanguage] == 2) return ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Age", "Type a age betweeen 13 and 80.\n\nType your character age.", "Ok", "Close");
				}
				if(strval(inputtext) < 13 || strval(inputtext) > 80)
				{
					if(pInfo[playerid][pLanguage] == 1) return ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Age", "Tasteaza o varsta cuprinsa intre 13 si 80.\n\nTasteaza varsta caracterului tau.", "Ok", "Close");
					if(pInfo[playerid][pLanguage] == 2) return ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Age", "Type a age betweeen 13 and 80.\n\nType your character age.", "Ok", "Close");
				}
				if(!IsNumeric(inputtext))
				{
					if(pInfo[playerid][pLanguage] == 1) return ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Age", "Tasteaza o varsta cuprinsa intre 13 si 80.\n\nTasteaza varsta caracterului tau.", "Ok", "Close");
					if(pInfo[playerid][pLanguage] == 2) return ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Age", "Type a age betweeen 13 and 80.\n\nType your character age.", "Ok", "Close");
				}
				else
				{
					new AgeQuerry[255];
					mysql_format(Database, AgeQuerry, sizeof(AgeQuerry), "UPDATE `USERS` SET `Age` = '%d' WHERE `USERNAME`='%s'", inputtext, pInfo[playerid][pName]);
					mysql_query(Database, AgeQuerry);
                                        .....
Reply
#2

Because inputtext is still a string.

You need to turn it into a integer using strval.

Example:
PHP код:
new inputtext] = "250";
new 
iValue strvalinputtext ); // iValue is now '250' 
https://sampwiki.blast.hk/wiki/Strval
Reply
#3

Thx, you know how to check if a string is a email? like if contains "@"
Reply
#4

Quote:
Originally Posted by C0oL3r
Посмотреть сообщение
Thx, you know how to check if a string is a email? like if contains "@"
you can find a @ with strfind (tuto link - https://sampwiki.blast.hk/wiki/Strfind)
Reply
#5

Thanks!
Reply
#6

its useless to try and find @ because fake emails can still be put. x@y.z ..even if you try to find the big email names it still wont assure you there are not going to be any false emails...so working for nothing imo.

just tell them to use correct email because they`ll need it to reset their passwords and let them decide if they put their email or not.
Reply
#7

Quote:
Originally Posted by PepsiCola23
Посмотреть сообщение
its useless to try and find @ because fake emails can still be put. x@y.z ..even if you try to find the big email names it still wont assure you there are not going to be any false emails...so working for nothing imo.

just tell them to use correct email because they`ll need it to reset their passwords and let them decide if they put their email or not.
for that reasons, you can check a whole mail or just send the verification code or something like this to his mail for confirm the mail.
Reply
#8

i know that will be fake emails, but if they want to recover the account if it will forgot the password it will put the real email, if not, succes with a new account
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)