Whats wrong with this? (MySQL R33)
#1

Hey,

I'm trying to rescript my gamemode to update features like the login/register system. I've been upgrading from MySQL R5 to R33. I've came across a problem whilst saving data on disconnect. It saves some of the data, but not all.

Here is what I get in the MySQL log,

Код:
[17:59:57] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called
[18:02:35] [DEBUG] mysql_format - connection: 1, len: 165, format: "UPDATE `testdata` SET `pAdmin`=%d, `pWarns`=%d, `pScore`=%d, `pMoney`=%d, `pSeconds`=%d, `pHours`=%d WHERE `user` = %e"
[18:02:35] [DEBUG] mysql_format - connection: 1, len: 165, format: "UPDATE `testdata` SET `pKills`=%d, `pDeaths`=%d, `pVip`=%d, `pSwat`=%d, `pArmy`=%d, `pTazers`=%d WHERE `user` = %e"
[18:02:35] [DEBUG] mysql_format - connection: 1, len: 170, format: "UPDATE `testdata` SET `pCuffs`=%d, `pArrests`=%d, `pRobs`=%d, `pRapes`=%d, `pEvade`=%d, `pCookies`=%d WHERE `user` = %e"
[18:02:35] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `testdata` SET `pAdmin`=1, `pWarns`=2, `pScore`=0, `pMone", callback: "(null)", format: "(null)"
[18:02:35] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called
[18:02:35] [DEBUG] mysql_tquery - scheduling query "UPDATE `testdata` SET `pAdmin`=1, `pWarns`=2, `pScore`=0, `pMoney`=0, `pSeconds`=17, `pHours`=2 WHERE `user` = DB8160D677749437C3D5E208099EFE1DE45D47"..
[18:02:35] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `testdata` SET `pKills`=2, `pDeaths`=1, `pVip`=2, `pSwat`", callback: "(null)", format: "(null)"
[18:02:35] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called
[18:02:35] [DEBUG] mysql_tquery - scheduling query "UPDATE `testdata` SET `pKills`=2, `pDeaths`=1, `pVip`=2, `pSwat`=1, `pArmy`=2, `pTazers`=1 WHERE `user` = itsDanny2"..
[18:02:35] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `testdata` SET `pCuffs`=2, `pArrests`=1, `pRobs`=2, `pRap", callback: "(null)", format: "(null)"
[18:02:35] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called
[18:02:35] [DEBUG] mysql_tquery - scheduling query "UPDATE `testdata` SET `pCuffs`=2, `pArrests`=1, `pRobs`=2, `pRapes`=1, `pEvade`=2, `pCookies`=1 WHERE `user` = itsDanny2"..
[18:02:35] [DEBUG] CMySQLQuery::Execute[()] - starting query execution
[18:02:35] [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 'DB8160D677749437C3D5E208099EFE1DE45D47' at line 1
[18:02:35] [DEBUG] CMySQLQuery::Execute[()] - error will be triggered in OnQueryError
[18:02:35] [DEBUG] CMySQLQuery::Execute[()] - data being passed to ProcessCallbacks()
[18:02:35] [DEBUG] CMySQLQuery::Execute[()] - starting query execution
[18:02:35] [ERROR] CMySQLQuery::Execute[()] - (error #1054) Unknown column 'itsDanny2' in 'where clause'
[18:02:35] [DEBUG] CMySQLQuery::Execute[()] - error will be triggered in OnQueryError
[18:02:35] [DEBUG] CMySQLQuery::Execute[()] - data being passed to ProcessCallbacks()
[18:02:35] [DEBUG] CMySQLQuery::Execute[()] - starting query execution
[18:02:35] [ERROR] CMySQLQuery::Execute[()] - (error #1054) Unknown column 'itsDanny2' in 'where clause'
[18:02:35] [DEBUG] CMySQLQuery::Execute[()] - error will be triggered in OnQueryError
[18:02:35] [DEBUG] CMySQLQuery::Execute[()] - data being passed to ProcessCallbacks()
Код:
(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 'DB8160D677749437C3D5E208099EFE1DE45D47' at line 1
Here is the update code,


pawn Код:
mysql_format(mysql, query, sizeof(query), "UPDATE `"PlayerTable"` SET `pAdmin`=%d, `pWarns`=%d, `pScore`=%d, `pMoney`=%d, `pSeconds`=%d, `pHours`=%d WHERE `user` = %e", pInfo[playerid][pAdmin], pInfo[playerid][pWarns], GetPlayerScore(playerid), GetPlayerMoney(playerid), pInfo[playerid][pSeconds], pInfo[playerid][pMinutes], pInfo[playerid][pHours], Name[playerid]);
        mysql_format(mysql, query1, sizeof(query1), "UPDATE `"PlayerTable"` SET `pKills`=%d, `pDeaths`=%d, `pVip`=%d, `pSwat`=%d, `pArmy`=%d, `pTazers`=%d WHERE `user` = %e", pInfo[playerid][pKills], pInfo[playerid][pDeaths], pInfo[playerid][pVip], pInfo[playerid][pSwat], pInfo[playerid][pArmy], pInfo[playerid][pTazers], Name[playerid]);
        mysql_format(mysql, query2, sizeof(query2), "UPDATE `"PlayerTable"` SET `pCuffs`=%d, `pArrests`=%d, `pRobs`=%d, `pRapes`=%d, `pEvade`=%d, `pCookies`=%d WHERE `user` = %e", pInfo[playerid][pCuffs], pInfo[playerid][pArrests], pInfo[playerid][pRobs], pInfo[playerid][pRapes], pInfo[playerid][pEvade], pInfo[playerid][pCookies], Name[playerid]);

        mysql_tquery(mysql, query, "", "");
        mysql_tquery(mysql, query1, "", "");
        mysql_tquery(mysql, query2, "", "");
How am I able to fix this problem?

Thanks
Reply
#2

pawn Код:
mysql_format(mysql, query, sizeof(query), "UPDATE `"PlayerTable"` SET `pAdmin`=%d, `pWarns`=%d, `pScore`=%d, `pMoney`=%d, `pSeconds`=%d, `pHours`=%d WHERE `user` = %e", pInfo[playerid][pAdmin], pInfo[playerid][pWarns], GetPlayerScore(playerid), GetPlayerMoney(playerid), pInfo[playerid][pSeconds], pInfo[playerid][pHours], Name[playerid]);
mysql_format(mysql, query1, sizeof(query1), "UPDATE `"PlayerTable"` SET `pKills`=%d, `pDeaths`=%d, `pVip`=%d, `pSwat`=%d, `pArmy`=%d, `pTazers`=%d WHERE `user` = %e", pInfo[playerid][pKills], pInfo[playerid][pDeaths], pInfo[playerid][pVip], pInfo[playerid][pSwat], pInfo[playerid][pArmy], pInfo[playerid][pTazers], Name[playerid]);
mysql_format(mysql, query2, sizeof(query2), "UPDATE `"PlayerTable"` SET `pCuffs`=%d, `pArrests`=%d, `pRobs`=%d, `pRapes`=%d, `pEvade`=%d, `pCookies`=%d WHERE `user` = %e", pInfo[playerid][pCuffs], pInfo[playerid][pArrests], pInfo[playerid][pRobs], pInfo[playerid][pRapes], pInfo[playerid][pEvade], pInfo[playerid][pCookies], Name[playerid]);

mysql_tquery(mysql, query, "", "");
mysql_tquery(mysql, query1, "", "");
mysql_tquery(mysql, query2, "", "");
You had an extra variable in your first query, pMinutes. I removed it from the parameters list, but if you want to keep it, edit the query and add `pMinutes`=%d instead.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)