SA-MP Forums Archive
Problem Mysql - 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: Problem Mysql (/showthread.php?tid=503787)



Problem Mysql - Charlie009 - 31.03.2014

Hi, I'm trying to make a system to save the houses but when testing it appears on the console:

[01:57:51] Error #1064 - Error: 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 'М¬Los Santos Civic Center)' at line 1 | Query: INSERT INTO houses (id, x, y, z, Price, Street) VALUES (2, 1377.808349, -1752.953247, 14.140625, 30, М¬Los Santos Civic Center)

the error in this line: (A part of the function)

Код:
stock AddHouse(Float:x, Float:y, Float:z, price, zone, own[]="Nobody", descripcion[]="Nothing")
{
format(query, 512, "INSERT INTO houses (id, x, y, z, Price, Street) VALUES (%d, %f, %f, %f, %d, %s)", ret, x, y, z, precio, zone);
Код:
stock GetPlayer2DZone(playerid, zone[], len){
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
 	for(new i = 0; i != sizeof(gSAZones); i++ )
 	{
		if(x >= gSAZones[i][SAZONE_AREA][0] && x <= gSAZones[i][SAZONE_AREA][3] && y >= gSAZones[i][SAZONE_AREA][1] && y <= gSAZones[i][SAZONE_AREA][4])
		{
		    return format(zone, len, gSAZones[i][SAZONE_NAME], 0);
		}
	}
	return 0;
}
i don't know why this happen, sorry for my bad english. :/


Re: Problem Mysql - RenovanZ - 31.03.2014

pawn Код:
format(query, 512, "INSERT INTO houses (id, x, y, z, Price, Street) VALUES (%d, %f, %f, %f, %d, '%s')", ret, x, y, z, precio, zone);