How can I converte my code with R7‘s mysql_function_query
#1

The new mysql plugin R7‘s mysql_function_query() makes me very confused.
Could any one please help me?

My old code is as follows:
Code:
public MySQLCheckAccount(name[]) 
{
	new query[128],id;
	mysql_real_escape_string(name, name);
	format(query, sizeof(query), "SELECT id FROM users WHERE `Name` = '%s' LIMIT 1", name);
	mysql_query(query);
	mysql_store_result();
	if (mysql_num_rows()==0) return 0;
	else
	{
		mysql_fetch_row(name);
		intid = strval(id);
		return id;
	}
}
When I faced with R7, mysql_query is not work
So I change the code to
Code:
public MySQLCheckAccount(name[]) 
{
	new query[128],id;
	mysql_real_escape_string(name, name);
	mysql_format(query, sizeof(query), "SELECT id FROM users WHERE `Name` = '%s' LIMIT 1", name);
	mysql_function_query(Handel,query,true,"onMySQLCheckAccount","","");
}
public onMySQLCheckAccount() 
{
        cache_get_row(0, 0, tmp), id= strval(tmp);
        return 1;
BUT HOW CAN I return the value "id" to where I'v called the MySQLCheckAccount(name) As the old code did????
}
BUT HOW CAN I return the value "id" to where I'v called the MySQLCheckAccount(name) As the old code did?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)