MySQL, Undefined symbol, and more errors
#1

Hello, i'm learning scripting by watching XSLADEHDX, here's the line and the errors i get on this line



Line:
Код:
new query[126]; pName[MAX_PLAYER_NAME];

Errors:
Код:
:\Users\Divya\Desktop\samp\pawno\CNR.pwn(61) : error 017: undefined symbol "pName"
C:\Users\Divyam\Desktop\samp\pawno\CNR.pwn(61) : warning 215: expression has no effect
C:\Users\Divyam\Desktop\samp\pawno\CNR.pwn(61) : error 001: expected token: ";", but found "]"
C:\Users\Divyam\Desktop\samp\pawno\CNR.pwn(61) : error 029: invalid expression, assumed zero
C:\Users\Divyam\Desktop\samp\pawno\CNR.pwn(61) : fatal error 107: too many error messages on one line
Reply
#2

";" is a way of saying to compiler that we reached end of statement.

pawn Код:
new a;
new b[32];
You can create two variables without having to repeat "new" keyword, using a comma

pawn Код:
new a, b[32];
But you have a typo, and did

pawn Код:
new a; b[32];
Change it to comma and you're good to go.
Reply
#3

Oh, i did that to check if doing so fixes the error, but it didnt.. removed it but it still didnt work.
Reply
#4

Ok, fixed that, but now it shows error on line 63rd, line is
Код:
format(query, sizeof(query), "Select from accounts where name = '%s', pName);
Errors:
Код:
C:\Users\Divyam\Desktop\samp\pawno\CNR.pwn(63) : error 037: invalid string (possibly non-terminated string)
C:\Users\Divyam\Desktop\samp\pawno\CNR.pwn(63) : error 017: undefined symbol "Select"
C:\Users\Divyam\Desktop\samp\pawno\CNR.pwn(63) : error 017: undefined symbol "from"
C:\Users\Divyam\Desktop\samp\pawno\CNR.pwn(63) : fatal error 107: too many error messages on one line
Reply
#5

Missing a "
PHP код:
format(querysizeof(query), "Select from accounts where name = '%s'"pName); 
Reply
#6

PHP код:
format(querysizeof(query), "SELECT * FROM `accounts` WHERE `name` = '%s'"pName); 
If you are asking why, becouse in your first query, you are selecting nothing from accounts where name is Sanady for example, so it doesn`t make sanse, in my version. You are selecting everything from accounts where name is Sanady.
Reply
#7

THANKS!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)