Query error -
Mattakil - 02.12.2013
I cant seem to figure out the error, even splitting the lines didnt help
pawn Код:
format(Query, sizeof(Query), "INSERT INTO `ACCOUNTS` (IP`, `PASSWORD`, `CASH`, `NAME`, `ADMIN`, `DEV`, `HELPER`, `VIP`, `LEVEL`, `XPOS`,\
`YPOS`, `ZPOS`, `NUMBER`, `PTIME`, `BANNED`, `SEX`, `TUT`, `FACTION`, \
`FACLEVEL`, `FACRANK`, `PAYCHECK`, `PAYDAY`,`HOURS`, `JAILED`, `MASK`, `JOB`, \
`LICENSE`, `CARKEY`, `CARKEY2`, `CARKEY3`, `GUNLICENSE`, `ARRESTED`, `WALKIE`, `BANREASON`, `GASCAN`, `ID`, `BANADMIN`, `BANDATE`, `SKIN`, \
/*Line 164*/VALUES('%s','%s', 5000, '%s', 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 'none', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'none', 0, %d, 'none', 'none', 0)", ip, inputtext, GetName(playerid), UID);
Код:
(163) : error 075: input line too long (after substitutions)
(164) : error 037: invalid string (possibly non-terminated string)
(164) : error 017: undefined symbol "INSERT"
(164) : error 017: undefined symbol "INTO"
Re: Query error -
Jefff - 03.12.2013
pawn Код:
Query = "INSERT INTO `ACCOUNTS` (`IP`, `PASSWORD`, `CASH`, `NAME`, `ADMIN`, `DEV`, `HELPER`, `VIP`, `LEVEL`, `XPOS`,\
`YPOS`, `ZPOS`, `NUMBER`, `PTIME`, `BANNED`, `SEX`, `TUT`, `FACTION`, `FACLEVEL`, `FACRANK`, `PAYCHECK`, `PAYDAY`,`HOURS`, `JAILED`, `MASK`, `JOB`,";
format(Query,sizeof(Query),"%s `LICENSE`, `CARKEY`, `CARKEY2`, `CARKEY3`, `GUNLICENSE`, `ARRESTED`, `WALKIE`, `BANREASON`, `GASCAN`, `ID`, `BANADMIN`, `BANDATE`, `SKIN`)\
VALUES('%s','%s', 5000, '%s', 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 'none', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'none', 0, %d, 'none', 'none', 0)",
Query, ip, inputtext, GetName(playerid), UID);
Use default values for `CASH`, `ADMIN`, `DEV`, `HELPER`, `VIP`, `LEVEL`, `XPOS ... and your query will be shorted
pawn Код:
format(Query,sizeof(Query),"INSERT INTO `ACCOUNTS` (`IP`, `PASSWORD`, `NAME`, `ID`) VALUES ('%s', '%s', '%s', %d)",ip, inputtext, GetName(playerid), UID);
looks better
Re: Query error - Emmet_ - 03.12.2013
OP, you should use default values on your columns so you don't have to insert all of the columns when inserting a new row.
http://dev.mysql.com/doc/refman/5.0/...-defaults.html