Query error.
#1

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?
Reply
#2

pawn Код:
format(query, 128, "SELECT `group` FROM `player_groups` WHERE `id` = '%i' ", PlayerInfo[playerid][id]);
mysql_query(query);
Reply
#3

Why do i have to put '`' ? I don't have them in all my queries and it works fine.
Reply
#4

you don't need '' for integers, and put %d not %i
Reply
#5

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?
Reply
#6

pawn Код:
format(query, 128, "SELECT group FROM player_groups WHERE `id` = %i", PlayerInfo[playerid][id]);
you only use ' ' for %s
Reply
#7

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)