PDA

View Full Version : error 017: undefined symbol "INSERT"


Johangelo1
23/03/2017, 08:37 PM
How can i fix this?


MG.pwn(10494) : error 075: input line too long (after substitutions)
MG.pwn(10495) : error 037: invalid string (possibly non-terminated string)
MG.pwn(10495) : error 017: undefined symbol "INSERT"
MG.pwn(10495) : error 017: undefined symbol "INTO"
MG.pwn(10495) : fatal error 107: too many error messages on one line


format(Query, sizeof(Query), "INSERT INTO `users` (`name`, `password`, `ip`,`registro`,`score`, `dinero`, `admin`,`kills`, `deaths`, `jail`, `jailsec`, `skin`, `Turbo`, `Radio`, `Autofix`, `Nivel`, `Experiencia`,`MonsterKills`, `Color`, `Headshot`,`Horas`, `Minutos`, `Segundos`, `DuelosWins`,`VIP`, `VIPTIME`,`CHATCOLOR`, `RACE`,`HOUSES`, `CONNECTED`, `PLAYERID`, `LCONNECT`, `POSX`, `POSY`, `POSZ`) VALUES ('%s','%s','%s,'%s',0,0,0,0,0,0,0,0,0,'1',0,0,0,0, '-1',0,0,0,0,0,0,0,'16777215',0,0,1,'%d',0,0,0,0)",

DB_Escape(PI[playerid][JugadorNick]),DB_Escape(hashpass),
PlayerIP(playerid),PI[playerid][registro],playerid);

db_query(_DB_, Query);



I did it that way and the error still persists


format(Query, sizeof(Query), "INSERT INTO `users` (`name`, `password`, `ip`,`registro`,`score`, `dinero`, `admin`,`kills`, `deaths`, `jail`, `jailsec`, `skin`, `Turbo`, `Radio`, `Autofix`, `Nivel`, `Experiencia`,`MonsterKills`, `Color`, `Headshot`,`Horas`, `Minutos`, `Segundos`, `DuelosWins`, \
`VIP`, `VIPTIME`,`CHATCOLOR`, `RACE`,`HOUSES`, `CONNECTED`, `PLAYERID`, `LCONNECT`, `POSX`, `POSY`, `POSZ`) VALUES ('%s','%s','%s,'%s',0,0,0,0,0,0,0,0,0,'1',0,0,0,0, '-1',0,0,0,0,0,0,0,'16777215',0,0,1,'%d',0,0,0,0)",

DB_Escape(PI[playerid][JugadorNick]),DB_Escape(hashpass),
PlayerIP(playerid),PI[playerid][registro],playerid);

db_query(_DB_, Query);



HELP ME!

Mencent
23/03/2017, 08:47 PM
Hello.

Look at my post like here:
http://forum.sa-mp.com/showthread.php?t=631025

Johangelo1
23/03/2017, 09:01 PM
Hello.

Look at my post like here:
http://forum.sa-mp.com/showthread.php?t=631025

But that is UPDATE as I do in this case?

Mencent
23/03/2017, 09:04 PM
You can do it just like this. :)

Johangelo1
23/03/2017, 09:12 PM
I did it like that. What can you see as evil?

EDIT: Does not create the table

format(Query,sizeof(Query),"INSERT INTO `users` (`name`, `password`, `ip`,`registro`,`score`, `dinero`, `admin`,`kills`, `deaths`, `jail`, `jailsec`, `skin`, `Turbo`, `Radio`, `Autofix`, `Nivel`, `Experiencia`,`MonsterKills`, `Color`, `Headshot`,`Horas`, `Minutos`, `Segundos`, `DuelosWins`) VALUES ('%s','%s','%s,'%s',0,0,0,0,0,0,0,0,0,'1',0,0,0,0, '-1',0,0,0,0,0)",
DB_Escape(PI[playerid][JugadorNick]),DB_Escape(hashpass),PlayerIP(playerid),PI[playerid][registro],playerid);

format(Query,sizeof(Query),"%d, `VIP`, `VIPTIME`,`CHATCOLOR`, `RACE`,`HOUSES`, `CONNECTED`, `PLAYERID`, `LCONNECT`, `POSX`, `POSY`, `POSZ`) VALUES (0,0,'16777215',0,0,1,'%d',0,0,0,0)",
Query);

db_query(_DB_, Query);

Private200
23/03/2017, 10:02 PM
You are formatting Query with a new input. You are simply clearing the old value and inserting "%d, `VIP`, `VIPTIME`,`CHATCOLOR`, `RACE`,`HOUSES`, `CONNECTED`, `PLAYERID`, `LCONNECT`, `POSX`, `POSY`, `POSZ`) VALUES (0,0,'16777215',0,0,1,'%d',0,0,0,0)"

Go for:

strcat(Query, "INSERT INTO `users` (`name`, `password`, `ip`,`registro`,`score`, `dinero`, `admin`,`kills`, `deaths`, `jail`, `jailsec`, `skin`, `Turbo`, `Radio`, `Autofix`, `Nivel`, `Experiencia`,`MonsterKills`, `Color`,");
strcat(Query, "`Headshot`,`Horas`, `Minutos`, `Segundos`, `DuelosWins`,`VIP`, `VIPTIME`,`CHATCOLOR`, `RACE`,`HOUSES`, `CONNECTED`, `PLAYERID`, `LCONNECT`, `POSX`, `POSY`, `POSZ`");
strcat(Query, " VALUES ('%s','%s','%s,'%s',0,0,0,0,0,0,0,0,0,'1',0,0,0,0, '-1',0,0,0,0,0,0,0,'16777215',0,0,1,'%d',0,0,0,0)");
format(Query, sizeof(Query), DB_Escape(PI[playerid][JugadorNick]),DB_Escape(hashpass),
PlayerIP(playerid),PI[playerid][registro],playerid);

db_query(_DB_, Query);

It should work.

Private200
25/03/2017, 07:05 PM
Did it get solved?

DobbysGamertag
25/03/2017, 08:29 PM
Why on earth are you writing all those 0's to the database? Doesn't anyone use default values anymore?