SA-MP Forums Archive
MySQL Issue? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL Issue? (/showthread.php?tid=426088)



MySQL Issue? - nmader - 27.03.2013

Alright, I am finally attempting to take on the knowledge of MySQL and to begin script with it fluently, but for some reason I am getting this bug when trying to read the player's name from the database:

pawn Код:
format(Query, sizeof(Query), "SELECT `nick` FROM `playerdata` WHERE `nick` = %s", Player[playerid][Nick]);
I am getting this error:

pawn Код:
C:\Users\namder\Desktop\Lost Life Roleplay\gamemodes\CoVRP.pwn(89) : error 001: expected token: ";", but found "-identifier-"
I am truly confused; however any help and explanation would be greatly appreciated!


Re: MySQL Issue? - EiresJason - 27.03.2013

Look to the line above it, is there a ";" at the end of the line above this line?


Re: MySQL Issue? - nmader - 27.03.2013

Quote:
Originally Posted by EiresJason
Посмотреть сообщение
Look to the line above it, is there a ";" at the end of the line above this line?
Lol, why did I not think of that? My ignorance lead to the issue you just helped my solve, thanks! You have been given your first reputation point, thanks again!


Re: MySQL Issue? - EiresJason - 28.03.2013

Haha, thanks :P


Re: MySQL Issue? - Scenario - 28.03.2013

That query is going to (or should) return an error, by the way. You have to put apostrophe's around string place-holders (at least that's what I call the %s's in a string).

So, where you have:

pawn Код:
`nick` = %s
... it should be:

pawn Код:
`nick` = '%s'