• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] I need a code to find the name and check its existence in the database.
#1
I need a code to find the name and check its existence in the database, but I don't know what is the best code for this task so that it works at the highest possible speed and is optimal.

Sorry for my bad english ;)

Witch one is better?

Code:
Std::MySQLCheckAccount(const name[]) {
new Query[128];
format(Query, sizeof(Query), "SELECT 1 FROM `users` WHERE `username`='%s' LIMIT 1", name);
mysql_tquery(gMySQL, Query, "OnMySQLCheckAccount");
return true;
}
Void::OnMySQLCheckAccount() {
switch cache_num_rows() do {
case false: return print("Not find");
default: return print("Find");
}
}


Or

Code:
Std::MySQLCheckAccount2(const name[]) {
inline const checkAccount() {
switch cache_num_rows() do {
case false: return print("Not find");
default: return print("Find");
}
}
MySQL_PQueryInline(gMySQL, using inline checkAccount, "SELECT `username` FROM `users` WHERE `username` = '%s' LIMIT 1", name);
return true;
}
  Reply


Forum Jump: