MySQL_DoesAccountExist(nick[]) { new string[128]; format(string, sizeof(string), "SELECT `nickname` FROM `accounts` WHERE `nickname` = BINARY '%s'", nick); mysql_query(string); mysql_store_result(); new result = mysql_num_rows(); mysql_free_result(); if(result > 0) { return -1; } else { format(string, sizeof(string), "SELECT `nickname` FROM `accounts` WHERE `nickname` = '%s'", nick); mysql_query(string); mysql_store_result(); result = mysql_num_rows(); mysql_free_result(); if(result > 0) return -999; } return 0; }
MySQL_DoesAccountExist(nick[])
{
new string[128];
mysql_format('Your SQL Handle', string, sizeof(string), "SELECT `nickname` FROM `accounts` WHERE `nickname` = BINARY '%s'", nick);
mysql_tquery('Your SQL Handle', string, "OnAccountExistCheck", "s", nick);
}
forward OnAccountExistCheck(nick[]);
public OnAccountExistCheck(nick[]) {
if(cache_num_rows() == 0) {
return false;
}
return true;
}
mysql_store_result(); mysql_free_result();
Works thanks!
I have one question: Is this necessary? Код:
mysql_store_result(); mysql_free_result(); |