How can I optimize this script?
#1

Hello, anyone knows how to optimize this script?
PHP код:
mysql_query(SQL"SELECT * FROM users");
mysql_store_result();
new 
totalregistred mysql_num_rows();
mysql_free_result();
new 
Cachecachevariable1variable2qstr[90];
for(new 
i=1;i<totalregistredi++)
{
    
mysql_format(SQLqstrsizeof(qstr), "SELECT * FROM users WHERE `id` = '%d' AND `variableX` >= 1"i);
    
tut mysql_query(SQL,qstr);
    if(
cache_get_row_count() > 0)
    {
        
variable1 cache_get_field_content_int(0"variableY");
        
variable2 cache_get_field_content_float(0"variableZ");
        if(
variable1 >= x)
        {
           
variable1 variable2*10;
           
mysql_format(SQL, var, sizeof(var), "UPDATE `users` SET `variable2`='%d' WHERE `id`='%d'"variable1i);
           
mysql_tquery(SQL,var,"","");                  
        }
        
cache_delete(cache);
    }
}
//************Read my last reply************\\ 
I mean can I make so the function check and affect only registred players who have variableX equal or higher than x? I mean I don't want to check 10000 users at a time, because that would get a lot of time to execute this loop... and function.
I am using BlueG's mysql plugin.
Any help will be highly appreciate!And Marry Christmas everyone!
Reply


Messages In This Thread
How can I optimize this script? - by StRaphael - 26.12.2018, 15:10
Re: How can I optimize this script? - by StRaphael - 26.12.2018, 15:56
Re: How can I optimize this script? - by StRaphael - 26.12.2018, 16:04
Re: How can I optimize this script? - by StRaphael - 26.12.2018, 17:06
Re: How can I optimize this script? - by StRaphael - 26.12.2018, 18:54
Re: How can I optimize this script? - by Jefff - 26.12.2018, 23:42
Re: How can I optimize this script? - by Logic_ - 27.12.2018, 12:25

Forum Jump:


Users browsing this thread: 1 Guest(s)