help (mysql)
#1

i got this error when i try to register
PHP код:
[22:52:40] [DEBUGCMySQLQuery::Execute[OnAccountRegister] - starting query execution
[22:52:40] [ERRORCMySQLQuery::Execute[OnAccountRegister] - (error #1064) Erreur de syntaxe prиs de 'VALUES ('INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `Score`, ' а la ligne 1
[22:52:40] [DEBUGCMySQLQuery::Execute[OnAccountRegister] - error will be triggered in OnQueryError 
this is inserting query
pawn Код:
new query[3000];
            mysql_format(mysql, query, sizeof(query),"INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `Score`, `Kills`, `Deaths`, `Cookie`, `Notify` ,`TotalTime`,`SkinID`");
            mysql_format(mysql, query, sizeof(query),"%s`AccountLocked`, `AccountBanned`, `BanningAdmin`, `BannedReason`, `MoneyBank`,`Health`, `Armour`, `LastActivity`", query);
            mysql_format(mysql, query, sizeof(query),"%s`WeaponSlot1`, `WepSlotAmmo1`, `WeaponSlot2`, `WepSlotAmmo2`, `WeaponSlot3`, `WepSlotAmmo3`, `WeaponSlot4`, `WepSlotAmmo4`, `WeaponSlot5`, `WepSlotAmmo5`, `Money` ", query);
            mysql_format(mysql, query, sizeof(query),"VALUES ('%e', '%s', '%s', 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 99.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,)",query, Name[playerid], pInfo[playerid][Password], IP[playerid]);
            mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid);
Reply
#2

are you sure you made all tables correctly in mysql server? cuz codes looks complete
Reply
#3

Ryz, it's clear that you haven't read query :P

pawn Код:
new query[3000];
            mysql_format(mysql, query, sizeof(query),"INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `Score`, `Kills`, `Deaths`, `Cookie`, `Notify` ,`TotalTime`,`SkinID`");
            mysql_format(mysql, query, sizeof(query),"%s`AccountLocked`, `AccountBanned`, `BanningAdmin`, `BannedReason`, `MoneyBank`,`Health`, `Armour`, `LastActivity`", query);
            mysql_format(mysql, query, sizeof(query),"%s`WeaponSlot1`, `WepSlotAmmo1`, `WeaponSlot2`, `WepSlotAmmo2`, `WeaponSlot3`, `WepSlotAmmo3`, `WeaponSlot4`, `WepSlotAmmo4`, `WeaponSlot5`, `WepSlotAmmo5`, `Money`) ", query);
            mysql_format(mysql, query, sizeof(query),"VALUES ('%e', '%s', '%s', 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 99.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,)",query, Name[playerid], pInfo[playerid][Password], IP[playerid]);
            mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid);
this should do
Reply
#4

like this -
pawn Код:
new query[1000];
format(query,sizeof(query),""):
strcat(query,"INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `Score`, `Kills`, `Deaths`, `Cookie`, `Notify` ,`TotalTime`,`SkinID`");
strcat(query,"`AccountLocked`, `AccountBanned`, `BanningAdmin`, `BannedReason`, `MoneyBank`,`Health`, `Armour`, `LastActivity`");
strcat(query,"`WeaponSlot1`, `WepSlotAmmo1`, `WeaponSlot2`, `WepSlotAmmo2`, `WeaponSlot3`, `WepSlotAmmo3`, `WeaponSlot4`, `WepSlotAmmo4`, `WeaponSlot5`, `WepSlotAmmo5`, `Money`) ");
strcat(query,"VALUES ('%e', '%s', '%s', 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 99.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,)");
mysql_format(mysql, query,sizeof(query),query,Name[playerid], pInfo[playerid][Password], IP[playerid]);
mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid);
also see this http://forum.sa-mp.com/showpost.php?...18&postcount=6
Reply
#5

Dude, use default values in your tables. You're only inserting 3 actual variables, the rest are constants. Also read my tutorial on how to properly store weapon data in MySQL. Columns that have numbers in them should (in most cases) be moved to a separate table.
Reply
#6

Quote:
Originally Posted by CoaPsyFactor
Посмотреть сообщение
Ryz, it's clear that you haven't read query :P
too fast_ fail fast -_- .ty 4 pointing
Reply
#7

np, I had soooo many times that fail happened , and after that I started reading char by char if I don't see any logical problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)