14.09.2011, 18:38
That code can indeed be simplified a lot (making it faster as well). Since `name` is the only field being returned, there are no delimiters or anything else in the mysql_fetch_row returned string, so you can simply do:
This raises a small question: Why do you use mysql_format when there's no %e specifier involved? In this case it would be more simple to use the actual format function.
As you can see I removed some useless quotes. They are not required around table or field names, they are only necessary for strings. The very very small speed gain set aside, it makes the syntax easier to read in my opinion.
pawn Код:
mysql_fetch_row(Name);
pawn Код:
format(Query, sizeof(Query), "SELECT Name from players WHERE something=%d", value);