SA-MP Forums Archive
MYSQL Saving wrongly. - 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 Saving wrongly. (/showthread.php?tid=209399)



MYSQL Saving wrongly. - NewbBeginner - 10.01.2011

Код:
		case 3:
	    {
	 		if(!response)
		    {
		        SendClientMessage(playerid, -1, "Plz relog to make new.");
	            Kick(playerid);
			}
	        else
	        {
				format(Query, sizeof(Query), "UPDATE `accounts` SET `Day` = '%d' WHERE `Name` = '%s'", inputtext, GetName(playerid));
				mysql_query(Query);
				}
		}
It's my ondialogresponse, but it saves always with number 55, but I wront 7 into database, Why it keeps doing it ?
It's like PlayerInfo[playerid][pDay]


Re: MYSQL Saving wrongly. - Mr.Stranger - 10.01.2011

I think you have to make it separately


Re: MYSQL Saving wrongly. - NewbBeginner - 10.01.2011

Explane me


Re: MYSQL Saving wrongly. - JaTochNietDan - 10.01.2011

Well inputtext is a string and you're trying to insert it as an integer, you need to convert it to an integer before doing so, for example:

pawn Код:
format(Query, sizeof(Query), "UPDATE `accounts` SET `Day` = '%d' WHERE `Name` = '%s'", strval(inputtext), GetName(playerid));



Re: MYSQL Saving wrongly. - Jochemd - 10.01.2011

Or use %s instead

Btw, learn identing