SA-MP Forums Archive
Mysql wont create a table - 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: Mysql wont create a table (/showthread.php?tid=456150)



Mysql wont create a table - Blademaster680 - 04.08.2013

When ever I join my server it asks me to register because it isnt saving my player info to the database when I disconnect. It was saving before, But I decided to drop my user out of the database and since then it isnt creating my player info again Why is that?

Код:
		case 1:
		{
			if(response)
			{
				new query[126], pName[MAX_PLAYER_NAME];
				GetPlayerName(playerid, pName, sizeof(pName));
			
				format(query, sizeof(query), "INSERT INTO accounts (Name, Password, PlayerPos) VALUES ('%s', '%s', '1.0 2.0 3.0)", pName, inputtext);
				mysql_query(query);
				
				SendClientMessage(playerid, -1, "You have registered!");
				
				SetSpawnInfo(playerid, 0, 299, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
				SpawnPlayer(playerid);
				SetCameraBehindPlayer(playerid);
			}	
		}	
	}	
	return 1;
}
mysqldebug says "An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1.0 2.0 3.0)' at line 1)"


Re: Mysql wont create a table - radhakr - 04.08.2013

Missing ' after '1.0 2.0 3.0?


Re: Mysql wont create a table - DeMoX - 04.08.2013

That code doesn't create table, it inserts info on it
This code creates table :
Код:
mysql_query("CREATE TABLE IF NOT EXISTS accounts(Name VARCHAR(24), password VARCHAR(41), PlayerPos INT(20) )");