SA-MP Forums Archive
SQLite and saving date - 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: SQLite and saving date (/showthread.php?tid=635571)



SQLite and saving date - FailerZ - 09.06.2017

Nevermind I figured it out
I used UPDATE instead of INSERT

So I tried to save a date in my SQLite database but when the player register and logins everything is fine until the player spawns. He got kicked and all his data record is not saved anymore.

Here in the database creation:
Код HTML:
    db_query(Database, "CREATE TABLE IF NOT EXISTS Accounts (columns, RegisterDate VARCHAR(40), columns)");
Here the saving:
Код HTML:
				new d, m, y, mname[12], alldate[40];
				getdate(y, m, d);
				switch(m)
				{
					case 1: mname = "January";
					case 2: mname = "February";
					case 3: mname = "March";
					case 4: mname = "April";
					case 5: mname = "May";
					case 6: mname = "June";
					case 7: mname = "July";
					case 8: mname = "August";
					case 9: mname = "September";
					case 10: mname = "October";
					case 11: mname = "November";
					case 12: mname = "December";
				}
				format(alldate, sizeof(alldate), "%d-%s-%d", d, mname, y);
				format(Query, sizeof(Query), "INSERT INTO Accounts (RegisterDate) VALUES ('%s')", DB_Escape(alldate));
				db_query(Database, Query);