MYSQL INSERT INTO -
PaulDinam - 18.01.2013
why this code doesn't works.. i can't compile..
Код:
format(query, sizeof(query), "INSERT INTO `users` (name, password, cash, admin, tester, kills, deaths, registered, sex, skin, age, banned, warns, origin, muted, mutetime, carlic, lictests, FStyle, jailed, jailtime, resttime, note1, note1s, note2, note2s, note3, note3s, note4, note4s, note5, note5s) VALUES (\'%s\', \'%s\', \'%d\', \'%d\', \'%d\', \'%d\', \'%d\', \'%d\', \'%d\', \'%d\', \'%d\', \'%d\', \'%d\', \'%s\', \'%d\', \'%d\', \'%d\', \'%d\', \'%d\', \'%d\', \'%d\', \'%d\', \'%d\', \'%s\', \'%d\', \'%s\', \'%d\', \'%s\', \'%d\', \'%s\', \'%d\', \'%s\')",
it's half of the code, the error is:
rp.pwn(9426) : error 075: input line too long (after substitutions)
rp.pwn(9427) : error 027: invalid character constant
rp.pwn(9427) : error 017: undefined symbol "INSERT"
rp.pwn(9427) : error 017: undefined symbol "INTO"
Re: MYSQL INSERT INTO -
RajatPawar - 18.01.2013
Divide the line into two parts, as it says 'input line is
tooo long.'
What is ' \ ' because I don't know it! (I am sorry if it's valid.)
Re: MYSQL INSERT INTO -
Kwarde - 18.01.2013
@Rajat_Pawar: It's not needed in the code above. However, some people prefer to make this functions like this:
FUNCTION('string data');
And you can use:
FUNCTION("string data");
Do you see the differences? The ' and the ".
When you use the ' to make this, using that character again would mean that the string is ended, like this:
FUNCTION('string data '1' '2'');
This would mean that the string would stop reading here:
FUNCTION ('string data '
Then you'll get errors. However, when you use
\', it will be calculated as a normal
' so that this won't happen. But PaulDiman used it like this: FUNCTION("string data"); so it's not needed (as far as I know)
I hope you understood that because I have no idea how to explain it else.
Re: MYSQL INSERT INTO -
RajatPawar - 18.01.2013
Alright, got it. ' ends it. \' ends the 'part' and keeps it going on. Thanks!
Re: MYSQL INSERT INTO -
Kwarde - 18.01.2013
That's correct. Just like the
\ - If you use that one only, it indicates that the code is continueing on the line below (eg.):
Код:
#define something(%0, %1) printf("%d", (%0 + %1)); print("I just calculated something :D");
//Is the same as:
#define something(%0, %1) printf("%d", (%0 + %1)); \
print("I just calculated something :D");
So if you want to use the slash
\, you must do this double slash;
Код:
print("This is a slash: \\"); //Will print: This is a slash: \
Kind Regards,
Kwarde
Re: MYSQL INSERT INTO -
Djole1337 - 18.01.2013
Or either use strcat();
Like:
pawn Код:
new
iStr[1024]
;
strcat(iStr, "something1... ");
strcat(iStr, "something2... ");
Now you can do query or w/e you want.