Mysql Not Saving
#1

Quote:

[20:51:29] [DEBUG] mysql_connect - host: "localhost", user: "root", database: "newage", password: "****", port: 3306, autoreconnect: true, pool_size: 2
[20:51:29] [DEBUG] CMySQLHandle::Create - creating new connection..
[20:51:29] [DEBUG] CMySQLHandle::CMySQLHandle - constructor called
[20:51:29] [DEBUG] CMySQLHandle::Create - connection created (id: 1)
[20:51:29] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[20:51:29] [DEBUG] CMySQLConnection::Connect - connection was successful
[20:51:29] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[20:51:29] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[20:51:29] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[20:51:29] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[20:51:29] [DEBUG] CMySQLConnection::Connect - connection was successful
[20:51:29] [DEBUG] CMySQLConnection::Connect - connection was successful
[20:51:29] [DEBUG] CMySQLConnection::Connect - connection was successful
[20:51:29] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[20:51:29] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[20:51:29] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[20:51:50] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT `Password`, `ID` FROM `accounts` WHERE `Username` = '%s' LIMIT 1"
[20:51:50] [DEBUG] mysql_tquery - connection: 1, query: "SELECT `Password`, `ID` FROM `accounts` WHERE `Username` = 'Nao_", callback: "OnAccountCheck", format: "i"
[20:51:50] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - starting query execution
[20:51:50] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - query was successfully executed within 0.434 milliseconds
[20:51:50] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[20:51:50] [DEBUG] Calling callback "OnAccountCheck"..
[20:51:50] [DEBUG] cache_get_data - connection: 1
[20:51:50] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[20:51:56] [DEBUG] mysql_format - connection: 1, len: 1000, format: "INSERT INTO `accounts` (`Username`, `Password`, `IP`, `Skin`, `Cash`, `Bank`, `Gold` ,`Level`, `Respect`, `Admin`, `Helper`, `VI..."
[20:51:56] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO `accounts` (`Username`, `Password`, `IP`, `Skin`, `C", callback: "OnAccountRegister", format: "i"
[20:51:56] [DEBUG] CMySQLQuery::Execute[OnAccountRegister] - starting query execution
[20:51:56] [ERROR] CMySQLQuery::Execute[OnAccountRegister] - (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 ''No', '')' at line 1
[20:51:56] [DEBUG] CMySQLQuery::Execute[OnAccountRegister] - error will be triggered in OnQueryError
[20:51:56] [DEBUG] Calling callback "OnQueryError"..
[20:51:57] [DEBUG] mysql_format - connection: 1, len: 128, format: "UPDATE `accounts` SET `Admin`=%d, `VIP`=%d, `Cash`=%d, `X`=%f, `Y`=%f, `Z`=%f WHERE `ID`=%d"
[20:51:57] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `accounts` SET `Admin`=5, `VIP`=0, `Cash`=0, `X`=0.0, `Y`", callback: "(null)", format: "(null)"
[20:51:57] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[20:51:57] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 0.473 milliseconds
[20:51:57] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving

pawn Код:
format(query, sizeof(query), "INSERT INTO `accounts` (`Username`, `Password`, `IP`, `Skin`, `Cash`, `Bank`, `Gold` ,`Level`, `Respect`, `Admin`, `Helper`, `VIP`, `Tutorial`, `X`, `Y`, `Z`, `A`, `INT`, `VW`, `Health`,");
                format(query, sizeof(query), "%s `Armour`, `Weapon1`, `Ammo1`, `Weapon2`, `Ammo2`, `Weapon3`, `Ammo3`, `Weapon4`, `Ammo4`, `Weapon5`, `Ammo5`, `Weapon6`, `Ammo6`, `Weapon7`, `Ammo7`, `Weapon8`, `Ammo8`, `Weapon9`, `Ammo9`, `Weapon10`, `Ammo10`, `Weapon11`, `Ammo11`,", query);
                format(query, sizeof(query), "%s `Weapon12`, `Ammo12`, `Weapon13`, `Ammo13`, `Seconds`, `Minutes`, `Hours`, `Kills`, `Deaths`, `Banned`, `BanReason`) VALUES ('%s', '%s', '%s', 26, 5000, 10000, 1, 1, 0, 0, 0, 0,0, 0.0, 0.0, 0.0, 0.0, 0, 0, 100.0, 0.0, 0,0, 0,0, 0,0, 0,0,", query);
                format(query, sizeof(query),"%s 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0,0,0,0,0,0 'No', '')", query, RPNU(playerid), hashpass, PlayerInfo[playerid][pIP]);

                mysql_format(mysql, query, sizeof(query), query);
Reply
#2

man this code is not valid at all, you are doing everything in the wrong way, also increase the query size and try it instead of new query[120]; to new query[1200]; or something
Reply
#3

the query size is 2500. clearly you didn't read everything proper by ur response

"you are doing everything in the wrong way" - that really doesn't help
Reply
#4

u can do something:
pawn Код:
format(query, sizeof(query), "INSERT INTO `accounts` (`Username`, `Password`, `IP`, `Skin`, `Cash`, `Bank`, `Gold` ,`Level`, `Respect`, `Admin`, `Helper`, `VIP`, `Tutorial`, `X`, `Y`, `Z`, `A`, `INT`, `VW`, `Health` VALUES (values here)");
and then insert it to the db, keep on doing it on each message until u finish them
Reply
#5

Still no luck

Quote:

[21:40:50] [DEBUG] mysql_connect - host: "localhost", user: "root", database: "newage", password: "****", port: 3306, autoreconnect: true, pool_size: 2
[21:40:50] [DEBUG] CMySQLHandle::Create - creating new connection..
[21:40:50] [DEBUG] CMySQLHandle::CMySQLHandle - constructor called
[21:40:50] [DEBUG] CMySQLHandle::Create - connection created (id: 1)
[21:40:50] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[21:40:50] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:40:50] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:40:50] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[21:40:50] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[21:40:50] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[21:40:50] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:40:50] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:40:50] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:40:50] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:40:50] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:40:50] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:41:14] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT `Password`, `ID` FROM `accounts` WHERE `Username` = '%s' LIMIT 1"
[21:41:14] [DEBUG] mysql_tquery - connection: 1, query: "SELECT `Password`, `ID` FROM `accounts` WHERE `Username` = 'Mike", callback: "OnAccountCheck", format: "i"
[21:41:14] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - starting query execution
[21:41:14] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - query was successfully executed within 0.869 milliseconds
[21:41:14] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[21:41:14] [DEBUG] Calling callback "OnAccountCheck"..
[21:41:14] [DEBUG] cache_get_data - connection: 1
[21:41:14] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[21:41:24] [DEBUG] mysql_format - connection: 1, len: 128, format: "UPDATE `accounts` SET `Admin`=%d, `VIP`=%d, `Cash`=%d, `X`=%f, `Y`=%f, `Z`=%f WHERE `ID`=%d"
[21:41:24] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `accounts` SET `Admin`=5, `VIP`=0, `Cash`=0, `X`=1684.297", callback: "(null)", format: "(null)"
[21:41:24] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[21:41:24] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 0.423 milliseconds
[21:41:24] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving

pawn Код:
new hashpass[129], query[2500], tquery[2500];
                WP_Hash(hashpass,sizeof(hashpass),inputtext);
                format(tquery, sizeof(tquery), "INSERT INTO `accounts` (`Username`, `Password`, `IP`, `Skin`, `Cash`, `Bank`, `Gold` ,`Level`, `Respect`, `Admin`, `Helper`, `VIP`, `Tutorial`, `X`, `Y`, `Z`, `A`, `INT`, `VW`, `Health`) VALUES ('%s', '%s', '%s', 26, 5000, 10000, 1, 1, 0, 0, 0, 0,0, 0.0, 0.0, 0.0, 0.0, 0, 0, 100.0)", RPNU(playerid), hashpass, PlayerInfo[playerid][pIP]);
                mysql_format(mysql, query, sizeof(query), tquery);
                format(tquery, sizeof(tquery), "INSERT INTO `accounts` (`Armour`, `Weapon1`, `Ammo1`, `Weapon2`, `Ammo2`, `Weapon3`, `Ammo3`, `Weapon4`, `Ammo4`, `Weapon5`, `Ammo5`, `Weapon6`, `Ammo6`, `Weapon7`, `Ammo7`, `Weapon8`, `Ammo8`, `Weapon9`, `Ammo9`, `Weapon10`, `Ammo10`, `Weapon11`, `Ammo11`) VALUES (0.0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0)");
                mysql_format(mysql, query, sizeof(query), tquery);
                format(tquery, sizeof(tquery), "INSERT INTO `accounts` (`Weapon12`, `Ammo12`, `Weapon13`, `Ammo13`, `Seconds`, `Minutes`, `Hours`, `Kills`, `Deaths`, `Banned`, `BanReason`) VALUES (0,0, 0,0, 0,0, 0,0,0,0,0 'No', '')");
                mysql_format(mysql, query, sizeof(query), tquery);
Reply
#6

which mysql version are u using?
also try this:
pawn Код:
format(tquery, sizeof(tquery), "INSERT INTO `accounts` (`Username`, `Password`, `IP`, `Skin`, `Cash`, `Bank`, `Gold` ,`Level`, `Respect`, `Admin`, `Helper`, `VIP`, `Tutorial`, `X`, `Y`, `Z`, `A`, `INT`, `VW`, `Health`) VALUES ('%s', '%s', '%s', '26', '5000', '10000', '1', '1', '0', '0', '0', '0','0', '0.0', '0.0', '0.0', '0.0', '0', '0', '100.0')", RPNU(playerid), hashpass, PlayerInfo[playerid][pIP]);
try to delete the other format(tquary but save it in a notepad and if u got no errors in this one, then add one ' at the start and one ' at the end of every variable
Reply
#7

Quote:
Originally Posted by Eth
Посмотреть сообщение
which mysql version are u using?
also try this:
pawn Код:
format(tquery, sizeof(tquery), "INSERT INTO `accounts` (`Username`, `Password`, `IP`, `Skin`, `Cash`, `Bank`, `Gold` ,`Level`, `Respect`, `Admin`, `Helper`, `VIP`, `Tutorial`, `X`, `Y`, `Z`, `A`, `INT`, `VW`, `Health`) VALUES ('%s', '%s', '%s', '26', '5000', '10000', '1', '1', '0', '0', '0', '0','0', '0.0', '0.0', '0.0', '0.0', '0', '0', '100.0')", RPNU(playerid), hashpass, PlayerInfo[playerid][pIP]);
try to delete the other format(tquary but save it in a notepad and if u got no errors in this one, then add one ' at the start and one ' at the end of every variable
You have been told several times that ' ' are only for strings, and ` ` aren't necessary at all.



OT: Remove the ` ` and the ' ' on integers. ' ' is only for string specifiers (%s).

Btw: if you are updating, like saving why are you use an INSERT statement?
Reply
#8

I got it to work... Sorry it was registry giving trouble so " not inserting" i go it to work... i inserted the main things, and then made some more queries to update the the files

pawn Код:
new hashpass[129], query[2500];
                WP_Hash(hashpass,sizeof(hashpass),inputtext);

                format(query, sizeof(query), "INSERT INTO `accounts` (`Username`, `Password`, `IP`, `Skin`, `Cash`, `Bank`, `Gold` ,`Level`, `Respect`, `Admin`, `Helper`, `VIP`, `Tutorial`, `X`, `Y`, `Z`, `A`, `INT`, `VW`, `Health`, `Armour`) VALUES ('%s', '%s', '%s', 26, 5000, 10000, 1, 1, 0, 0, 0, 0,0, 0.0, 0.0, 0.0, 0.0, 0, 0, 100.0, 0.0)", RPNU(playerid), hashpass, PlayerInfo[playerid][pIP]);
                mysql_format(mysql, query, sizeof(query), query);
                mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid);

                format(query, sizeof(query), "UPDATE `accounts` SET `Weapon1`=0, `Ammo1`=0, `Weapon2`=0, `Ammo2`=0, `Weapon3`=0, `Ammo3`=0, `Weapon4`=0, `Ammo4`=0, `Weapon5`=0, `Ammo5`=0, `Weapon6`=0, `Ammo6`=0, `Weapon7`=0, `Ammo7`=0, `Weapon8`=0, `Ammo8`=0, `Weapon9`=0, `Ammo9`=0, `Weapon10`=0, `Ammo10`=0, `Weapon11`=0, `Ammo11`  WHERE `ID`=%d", PlayerInfo[playerid][pID]);
                mysql_tquery(mysql, query, "", "");
                format(query, sizeof(query), "UPDATE `accounts` SET `Weapon12`=0, `Ammo12`=0, `Weapon13`=0, `Ammo13`=0, `Seconds`=0, `Minutes`=0, `Hours`=0, `Kills`=0, `Deaths`=0, `Banned`=%s, `BanReason`=%s WHERE `ID`=%d", PlayerInfo[playerid][pID], "NO", "none");
                mysql_tquery(mysql, query, "", "");
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)