MySQL Problem
#4

That script isn't a great example of loading mass amounts of information. There is a much more efficient way that would take 50x less time to load from the database. There is also no mysql_free_result which could after a while cause issues.


pawn Код:
stock LoadCar() // You might want to make this an public so you could call it on an timer.  
{  
    new Query[255],atext[4],ltext[4], id;    
    mysql_query("SELECT * FROM vehicles"); // Querys the "Query" Variable.  
    mysql_store_result(); // Stores the result from Query  
    while(mysql_retrieve_row())
    {
        mysql_fetch_row(Query);
        sscanf(Query, "p<|>e<iffffiis[25]s[25]iiiiiiiii>",CarInfo[id]);  
        if(CarInfo[id][cAlarm] == 1)  atext="ON";  
        else  atext="OFF";  
        if(CarInfo[id][cAlarm] == 1)  ltext="ON";  
        else  ltext="OFF";  
        printf("CarInfo: %d Owner:%s, Alarm:%s, Insurance:%d Locked: %s",id,CarInfo[id][cOwner],atext,CarInfo[id][cInsurance],ltext);  
        id++;
    }  
    mysql_free_result();
    return 1;  
}
Reply


Messages In This Thread
MySQL Problem - by pop.nicku - 14.01.2012, 19:24
Re: MySQL Problem - by pop.nicku - 15.01.2012, 16:32
Re: MySQL Problem - by Ricop522 - 15.01.2012, 23:11
Re: MySQL Problem - by [HiC]TheKiller - 16.01.2012, 03:26
Re: MySQL Problem - by pop.nicku - 16.01.2012, 10:19

Forum Jump:


Users browsing this thread: 1 Guest(s)