Posts: 1,648
Threads: 482
Joined: Jun 2010
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.)
Posts: 1,648
Threads: 482
Joined: Jun 2010
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.
Posts: 371
Threads: 5
Joined: Oct 2007
Reputation:
0
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..
Posts: 1,648
Threads: 482
Joined: Jun 2010
That makes sense! I'm pretty stupid sometimes, I appreciate that.