SA-MP Forums Archive
Last MySQL Row Won't Retrieve. - 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: Last MySQL Row Won't Retrieve. (/showthread.php?tid=500333)



Last MySQL Row Won't Retrieve. - Dokins - 12.03.2014

pawn Код:
new escape[24], query[64];
                    mysql_real_escape_string(inputtext, escape);
                    format(query, sizeof(query), "SELECT `id` FROM `accounts` WHERE `PlayerName` = '%s' LIMIT 1", escape);
                    mysql_query(query);
                    mysql_store_result();
                   
                   
                    printf("rows %d", mysql_num_rows());

                    if(mysql_num_rows() > 0)
                    {
This function works, except for the last row in the table. It returns:

Quote:

[18:03:21] mysql error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''Grant_Reacher' at line 1

in the server log. (That is last name in the TABLE.)


Re: Last MySQL Row Won't Retrieve. - Matess - 12.03.2014

Bigger query?


Re: Last MySQL Row Won't Retrieve. - Dokins - 12.03.2014

I'll try that, but I didn't think it was....

EDIT: Well what do ya know...It worked. Thank you and I wanna slap myself.


Re: Last MySQL Row Won't Retrieve. - Matess - 12.03.2014

If you count only this "SELECT `id` FROM `accounts` WHERE `PlayerName` = '' " // it's about 52 chars and your query is 64.. and you must count limit and nick (24) too..


Re: Last MySQL Row Won't Retrieve. - Dokins - 12.03.2014

That makes sense! I'm pretty stupid sometimes, I appreciate that.