Problem with BlueG's MySql Plugin R7
#1

Hello,

I'm using last version (R7) of BlueG's MySQL plugin but im experiencing some errors:

I'm do de connection to database onGameModeInit with this function:

Код:
forward ConnectToDatabase();
public ConnectToDatabase()
{
	
	mgDBHandle=mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);
 
    if(mysql_ping() == 1)
    {    
        mysql_debug(1);
	    printf("[MYSQL]: Connection to `%s` succesful!", mysql_database);
	} 
	else
	{
	    printf("[MYSQL]: [ERROR]: Connection to `%s` failed!", mysql_database);
	}
	return 1;
}
After this When Player Do Login i'm doing this:


Код:
new password[256], IP[16], password2[256],temp[256],query[256];
format(query,sizeof(query),"SELECT * FROM USER WHERE PlayerName = '%s'",RPNU(playerid));
printf("%s",query);
mysql_function_query(mgDBHandle,query,true,"","");
new rows, fields;
rows=0;
fields=0;
cache_get_data(rows, fields);
if(rows)
{
        cache_get_row(0, 2, temp);
	printf("%d",rows);
	//cache_get_field_content(0, "Password", temp);
	printf("%s",temp);
	printf("ENTER HERE");
}
My Table User have one entry, and When i make this Query on phpmyadmin this is correct and return me one Player.
The field that i try get is password.




My console of server is return this:



Why i get NULL and 4960580 rows?

Please help
Reply
#2

You can't retrieve the result right after you sent the query with R7. That's the whole idea of threading. The plugin will call the callback you specified when it has retrieved the result. I suggest you read the topic by AndreT in the tutorial section.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)