No active cache error
#1

PHP код:
[23:54:31] [ERRORmysql_formatinvalid connection handle '0'
[23:54:31] [ERRORmysql_queryinvalid connection handle '0'
[23:54:31] [ERRORcache_get_row_countno active cache
[23:54:31] [WARNINGmysql_connectno password specified 
PHP код:
enum ClanData
{
    
ClanID,
    
ClanName[32],
    
ClanColor[32],
    
Float:ClanSpawn[32],
    
Leader[32],
    
Official,
    
Rank1,
    
Rank2,
    
Rank3,
    
Rank4,
    
Rank5
};
new 
ClanInfo[MAX_CLANS][ClanData]; 
PHP код:
forward LoadClans();
public 
LoadClans()
{
    new 
query[1500];
    new 
rows;
    
mysql_format(Databasequerysizeof(query), "SELECT * FROM `clans`");
    new 
Cache:result mysql_query(Databasequery);
    
cache_get_row_count(rows);
    if(!
rows)
    {
        
printf("[SERVER]: No clans were loaded from the MYSQL Database.");
        return 
0;
    }
    for (new 
0rows++)
    {
        
cache_get_value_name_int(i"ClanID"ClanInfo[i][ClanID]);
        
cache_get_value_name(i"ClanName"ClanInfo[i][ClanName]);
        
cache_get_value_name(i"ClanColor"ClanInfo[i][ClanColor]);
        
cache_get_value_name_float(i"ClanSpawn"ClanInfo[i][ClanSpawn]);
        
cache_get_value_name(i"Leader"ClanInfo[i][Leader]);
        
cache_get_value_name(i"Official"ClanInfo[i][Official]);
        
cache_get_value_name_int(i"Rank1"ClanInfo[i][Rank1]);
        
cache_get_value_name_int(i"Rank2"ClanInfo[i][Rank2]);
        
cache_get_value_name_int(i"Rank3"ClanInfo[i][Rank3]);
        
cache_get_value_name_int(i"Rank4"ClanInfo[i][Rank4]);
        
cache_get_value_name_int(i"Rank5"ClanInfo[i][Rank5]);
    }
    
cache_delete(result);
    
printf("[SERVER] %d clans were loaded from the MYSQL Database"rows);
    return 
1;

What's the problem here? Why does it say no clans were loaded from the database when there's 17 clans in the database, also check the mysql logs i posted..
Reply
#2

Post the LoadClans(); after connecting to your mysql database.

Did the same mistake.
Reply
#3

Quote:
Originally Posted by KinderClans
Посмотреть сообщение
Post the LoadClans(); after connecting to your mysql database.

Did the same mistake.
You mean i need to post it after OnGameModeInit? it's already posted below that.

EDIT: I got it now, couldn't understand you at first. Trying
Reply
#4

No, the LoadClans(); public should go somewhere on OnGameModeInit. You wrote this public, where do you call it?
Reply
#5

Quote:
Originally Posted by KinderClans
Посмотреть сообщение
No, the LoadClans(); public should go somewhere on OnGameModeInit. You wrote this public, where do you call it?
It load the clans now, thank you!
Reply
#6

Actually there's another problem, i don't know how can i get ClanID from the database so i tried something like this:

PHP код:
CMD<AD4>:setofficial(cmdidplayeridparams[])
{
    new 
query[600], string[300], targetidrows;
    new 
clancolorrank1[32], rank2[32], rank3[32], rank4[32], rank5[32];
    
clancolor = (clancolor << 8) | 0xFF;
    
mysql_format(Databasequerysizeof(query), "SELECT `ClanID` FROM `clans`");
    new 
Cache:result mysql_query(Databasequery);
    
cache_get_row_count(rows);
    if(
cache_num_rows() != 0)
    {
        if(
sscanf(params"dxds[32]s[32]s[32]s[32]s[32]"ClanIDclancolortargetidrank1rank2rank3rank4rank5)) return SendClientMessage(playeridCOLOR_RED"[USAGE]: /setofficial [clanid] [color] [leader] [rank1] [rank2] [rank3] [rank4] [rank5]");
        
format(stringsizeof(string), "[SERVER]: Faction ID %d has became official by administrator %s"ClanIDGetName(playerid));
        
SendMessageToAdmins(COLOR_PINKstring);
        
SaveClan(ClanID);
        
SetPlayerColor(targetidclancolor);
    }
    else
    {
         
SendClientMessage(playeridCOLOR_RED"[ERROR]: That clan does not exist.");
    }
    
    
cache_delete(result);
    return 
1;

But it's giving me warnings.. How can i get the clan id from the database and then use it on the command?
Reply
#7

Again? I already explained you in the last topic you made.
Reply
#8

Quote:
Originally Posted by KinderClans
Посмотреть сообщение
Again? I already explained you in the last topic you made.
No - that way it didn't work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)