Query error. - 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: Query error. (
/showthread.php?tid=262352)
Query error. -
WooTFTW - 17.06.2011
MySQL log:
Код:
[19:08:29] CMySQLHandler::Query(SELECT group FROM player_groups WHERE id = '12' ) - 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 'group FROM player_groups WHERE id = '12'' at line 1)
pawn Код:
format(query, 128, "SELECT group FROM player_groups WHERE id = '%i' ", PlayerInfo[playerid][id]);
mysql_query(query);
Why does it show that error?
AW: Query error. -
Julian12345 - 17.06.2011
pawn Код:
format(query, 128, "SELECT `group` FROM `player_groups` WHERE `id` = '%i' ", PlayerInfo[playerid][id]);
mysql_query(query);
Re: Query error. -
WooTFTW - 17.06.2011
Why do i have to put '`' ? I don't have them in all my queries and it works fine.
Re: Query error. -
CoaPsyFactor - 17.06.2011
you don't need '' for integers, and put %d not %i
Re: Query error. -
WooTFTW - 18.06.2011
Quote:
Originally Posted by CoaPsyFactor
you don't need '' for integers, and put %d not %i 
|
I don't think that there's any difference if i put " ' " or not. %d and %i is the same.
Could someone answer my question above?
Re: Query error. -
Whitetiger - 18.06.2011
pawn Код:
format(query, 128, "SELECT group FROM player_groups WHERE `id` = %i", PlayerInfo[playerid][id]);
you only use ' ' for %s
Re: Query error. -
WooTFTW - 18.06.2011
Quote:
Originally Posted by whitetigerswt
pawn Код:
format(query, 128, "SELECT group FROM player_groups WHERE `id` = %i", PlayerInfo[playerid][id]);
you only use ' ' for %s
|
Alright thanks. Got it fixed
Quote:
Originally Posted by Skorch
Why do i have to put '`' ? I don't have them in all my queries and it works fine.
|
Could someone answer this?