MySQL Loading
#1

Hello guys, I'm using the latest MySQL version, but when I load it, it works only for the callback, that I'm loading in it! Is it possible somethink like when I load at the start script it will be loaded for all commands, callbacks?
It is loading, I'm using it in the same callback, where it is loaded, but when I'm using it in command it is always "0".
The code (OnGameModeInit callback):
PHP код:
for(new 1cache_num_rows(); h++)
    {
          
mysql_format(zMySQLquerysizeof(query), "SELECT * FROM `houses` WHERE `ID` = %d"h);
          
mysql_tquery(zMySQLquery"LoadHouses""i"h);
    } 
And there is my loading callback:
PHP код:
forward LoadHouses(houseid);
public 
LoadHouses(houseid)
{
    new 
NumRows;
    
cache_get_row_count(NumRows);
    if(
numRows != 0)
    {
        for(new 
0NumRowsi++)
        {
            
cache_get_value_name(i"Position:X"HouseInfo[i][hX]);
            
printf("%f"HouseInfo[i][hX]);
        }
    }
    return 
1;

This result is printed CORRECT, but when I'm using this variable or another callback in command it prints "0"!
Reply
#2

Where is cache_num_rows coming from in OnGameModeInit()?

An example of a proper loading:

PHP код:
public OnGameModeInit(){
    
mysql_tquery(DB"SELECT * FROM `houses` ORDER BY `dbid` ASC""Thread_LoadHouses"); 
    return 
1;
}
Thread_LoadHouses(); public Thread_LoadHouses()
{
    if (!
cache_num_rows()) {
        return 
1;
    }
    for (new 
10cache_num_rows(); i++, j++) {
        
cache_get_value_float(j"HousePosX"Houses[i][HousePos][0]);
        
cache_get_value_float(j"HousePosY"Houses[i][HousePos][1]);
        
cache_get_value_float(j"HousePosZ"Houses[i][HousePos][2]);
    }
    return 
1;

Reply
#3

What means `dbid` and ASC ?
Can you describe it for me please ?
Reply
#4

EDITED: FIXED!!!!!!!! dbid was `ID` in my database, THANK YOU VERY MUCH! +1 REEEEPPPPP
Reply
#5

ASC is ascending.
Reply
#6

Thank you for the information!! THANK YOU FOR ALL!!!!!!!!!!!!!!!!!!!!!!
Reply
#7

I have one more problem! I can't find the number of rows, because I want to create one more row (a house)! Firstly when I start the server I can create one house and it is saving perfect, but when I try to create one more I have to restart the server again, because when I'm trying to create second house, it is not saving! The problem is because the rows are counted only one time (but in the script I'm counting them always when I want to create the ouse)
Here is my creating house command: (I'm testing the number, when I have created one house it works correct, but when I'm trying to create another one it doesn't counts) Please help me guys!)
PHP код:
mysql_tquery(zMySQL"SELECT * FROM `houses` ORDER BY `ID` ASC");
new 
cache_num_rows()+1;
printf("%d"h); 
Reply
#8

Anybody help ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)