MySQL: StrickenKid > BlueG
#1

What to change from StrickenKid to the new BlueG MySQL
Код:
bool:AccountExists(szAccount[])
{
	if(strlen(szAccount) > MAX_PLAYER_NAME) return false;

	new escaped_nick[MAX_PLAYER_NAME+16];
	mysql_real_escape_string(szAccount, escaped_nick);

	m_query("SELECT 1 FROM players WHERE nick = '%s' LIMIT 1", escaped_nick);

	new bool:exists = false;
	mysql_store_result();
	if(mysql_num_rows()) exists = true;
	mysql_free_result();

	return exists;
}
Код:
GetAccountID(szName[])
{
	new buffer[128], escapedNick[32];

	mysql_real_escape_string(szName, escapedNick);
	m_query("SELECT id FROM players WHERE nick = '%s' LIMIT 1", escapedNick);

	mysql_store_result();
	mysql_fetch_field("id", buffer);
	mysql_free_result();

	return strval(buffer);
}
Reply
#2

Nice. Good luck.


If you tell us what's wrong, or what problems you have, it would make it easier to actually help you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)