Error mysql
#1

Code:
Quote:

format(szQuery, sizeof(szQuery), "INSERT INTO `business` (`id`, `Type`, `Status`, `Owner`, `Name`, `PosX`, `PosY`, `PosZ`, `Money`, `Products`, `Sold`, `Level`, `Price`, `AP`, `EntranceFee`, `ReqRestock`, `Seized`, `Class`, `Expire`, `SupplyPointX`, `SupplyPointY`, `SupplyPointZ`) \
VALUES (%d, %d, %d, %d, %s, %f, %f, %f, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %f, %f, %f)",
i, BusinessData[i][b_iType], BusinessData[i][b_iStatus], BusinessData[i][b_szOwner], BusinessData[i][b_szName], BusinessData[i][b_fX], BusinessData[i][b_fY], BusinessData[i][b_fZ],
BusinessData[i][b_iMoney], BusinessData[i][b_iProducts], BusinessData[i][b_iSold], BusinessData[i][b_iLevel], BusinessData[i][b_iPrice], BusinessData[i][b_iAP], BusinessData[i][b_iEntranceFee], BusinessData[i][b_iReqRestock],
BusinessData[i][b_iSeized], BusinessData[i][b_iClass], BusinessData[i][b_iExpire], BusinessData[i][b_fSupplyPointX], BusinessData[i][b_fSupplyPointY], BusinessData[i][b_fSupplyPointZ]);

mysql_function_query(g_iConnectionHandle[0], szQuery, false, "OnQueryFinish", "i", THREAD_NO_RESULT);

Error server.log:
Quote:

Error #1064 - Error: 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 'State, 1837.038208, -1682.367919, 13.322872, 0, 0, 0, 1, 150000, 0, 0, 0, 0, 0, ' at line 1 | Query: INSERT INTO `business` (`id`, `Type`, `Status`, `Owner`, `PosX`, `PosY`, `PosZ`, `Money`, `Products`, `Sold`, `Level`, `Price`, `AP`, `EntranceFee`, `ReqRestock`, `Seized`, `Class`, `Expire`, `SupplyPointX`, `SupplyPointY`, `SupplyPointZ`) VALUES (1, 4, 0, The State, 1837.038208, -1682.367919, 13.322872, 0, 0, 0, 1, 150000, 0, 0, 0, 0, 0, 0, 0.000000, 0.000000, 0.000000) | Callback: OnQueryFinish

Error mysql_log:
[15:22:42] [ERROR] CMySQLQuery::Execute[OnQueryFinish(i)] - (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 'State, 1837.038208, -1682.367919, 13.322872, 0, 0, 0, 1, 150000, 0, 0, 0, 0, 0, ' at line 1
Reply
#2

Quote:

VALUES (1, 4, 0, The State, 1837.038208,

There's your problem. You need to wrap your %s in quotes. Also, you might want to escape that value (%q seems to be new addition to format)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)