MySQL Problem
#1

Can you fiind what's wrong with this?
Код:
	new save_query[2500], string[512];
	strcat(save_query, "INSERT INTO `server_interiors` (`sInteriorName`, `sEnterPosX`, `sEnterPosY`, `sEnterPosZ`, `sExitPosX`, `sExitPosY`, `sExitPosZ`, `sEnterInterior`, `sExitInterior`, `sEnterVirtualWorld`, `sExitVirtualWorld`, `sInteriorExists`) ");
	strcat(save_query, " VALUES ( ");
	format(string, sizeof(string), "'%s',", S_Interiors[interiorid][sInteriorName]);
	strcat(save_query, string);
	format(string, sizeof(string), "'%f',", S_Interiors[interiorid][sEnterPosX]);
	strcat(save_query, string);
	format(string, sizeof(string), "'%f',", S_Interiors[interiorid][sEnterPosY]);
	strcat(save_query, string);
	format(string, sizeof(string), "'%f',", S_Interiors[interiorid][sEnterPosZ]);
	strcat(save_query, string);
	format(string, sizeof(string), "'%f',", S_Interiors[interiorid][sExitPosX]);
	strcat(save_query, string);
	format(string, sizeof(string), "'%f',", S_Interiors[interiorid][sExitPosY]);
	strcat(save_query, string);
	format(string, sizeof(string), "'%f',", S_Interiors[interiorid][sExitPosZ]);
	strcat(save_query, string);
	format(string, sizeof(string), "'%d',", S_Interiors[interiorid][sEnterInterior]);
	strcat(save_query, string);
	format(string, sizeof(string), "'%d',", S_Interiors[interiorid][sExitInterior]);
	strcat(save_query, string);
	format(string, sizeof(string), "`%d',", S_Interiors[interiorid][sEnterVirtualWorld]);
	strcat(save_query, string);
	format(string, sizeof(string), "'%d',", S_Interiors[interiorid][sExitVirtualWorld]);
	strcat(save_query, string);
	format(string, sizeof(string), "'%d' )", S_Interiors[interiorid][sInteriorExists]);
	strcat(save_query, string);
	mysql_format(MySQL_Handle, save_query, sizeof(save_query), save_query);
	mysql_query(MySQL_Handle, save_query);
I always seem to get this error:
Код:
[13:17:56] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
Reply
#2

Yes.

Код:
`%d', 

'%d',

"'%f',"
Not exactly sure what you were doing.

' ' doesn't go around integers and floats.
Reply
#3

Thank you very much. it was that `d' thing )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)