mysql error
#1

Hello, i have an mysql error. Whats wrong with this?
Код:
format(query, sizeof(query), "INSERT INTO `phone_contacts` (where, name, phnumber) VALUES (%i, '%s', %i)", PlayerInfo[playerid][pID], inputtext, phnumber);
mysql_query(sqldb, query);
mysql_free_result();
Код:
[00:24:23] [DEBUG] mysql_query - connection: 1, query: "INSERT INTO `phone_contacts` (where, name, phnumber) VALUES (1, ", use_cache: true
[00:24:23] [DEBUG] CMySQLQuery::Execute - starting query execution
[00:24:23] [ERROR] CMySQLQuery::Execute - (error #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 'where, name, phnumber) VALUES (1, 'asd', 1234567)' at line 1
Reply
#2

anyone?
Reply
#3

I believe it's because you are using a column named 'where' which is a MySQL function.
Reply
#4

pawn Код:
format(query, sizeof(query), "INSERT INTO `phone_contacts` (`where`, `name`, `phnumber`) VALUES (%i, '%s', %i)", PlayerInfo[playerid][pID], inputtext, phnumber);
Replace your "format" line with this one.
Reply
#5

I would suggest you to use this:

pawn Код:
format(query, sizeof(query), "INSERT INTO `phone_contacts` (`name`, `phnumber`) VALUES ('%s', %i)", inputtext, phnumber);
Tell me if it works.

Edit: I deleted the wrong "where" and the value you were trying to insert which had no match (PlayerInfo[playerid][pID])
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)