19.09.2015, 11:24
So, I have this piece of code that's acting weird. The code generates a random 10-character string to be used as a security code, however, a few lines later, a query gets added at the end of it (no idea how... the code variable has a maximum of 10 characters), so the mysql debug query looks like this:
Obviously, the query fails to process. The code is 5b2N9UEc9U however, a query a few lines above randomly appears after that, even tho, as I just said, it shouldn't be able to fit at all! Also, for another extremely weird reason, the code itself (without the last U) is put in another place in the database...
This is the code itself:
Either it's an extremely easy problem to solve that I just can't see or pawno is drunk... A little help please?
Код:
UPDATE `players` SET `IPCode`='5b2N9UEc9USELECT * FROM `players` WHERE `Name`='Austin' AND `IPCode` IS NULL LIMIT 1' WHERE `Name`='Austin'
This is the code itself:
pawn Код:
new code[10];
randomString(code,10);
format(pInfo[playerid][IPCode],10,"%s",code);
new ipquery[128];
format(ipquery,sizeof(ipquery),"UPDATE `players` SET `IPCode`='%s' WHERE `Name`='%s'",code,playername);
mysql_query(ipquery);