Ciao, ho questa classe, scritta da me, quindi sono stato molto attento agli errori di battitura ma sono neofita nelle classi. PHP non mi da nessun errore e la connessione al Db è OK.

Questa è la classe:

Codice PHP:
class CheckAll {
        
        private 
$ID;
        private 
$ext1;
        private 
$ext2;
        private 
$old_date;
        private 
$new_date;
        private 
$time_new;
        private 
$legna;
        private 
$magazzino;
        private 
$premium;
        private 
$civilta;
        private 
$bonus;
        private 
$bonus_premium;
        private 
$falegnami;
        private 
$array_bonus;
        private 
$alg1;
        private 
$alg2;
        private 
$alg3;
        private 
$tot;
        
        public function 
__construct () {
        



            
$ID 1;
        
        }

        function 
checkLegna () {
        
            
$ex1 =  mysql_query("SELECT * FROM _utente WHERE ID = $ID LIMIT 1");
            
$ex2 =  mysql_query("SELECT * FROM _operai WHERE ID = $ID LIMIT 1");
            
            if ( ( 
mysql_num_rows $ex1 ) == ) && ( mysql_num_rows $ex2 ) == ) ) {
                
                while( ( 
$ex1 mysql_fetch_array($ex1) ) && ( $ex2 mysql_fetch_array($ex2) ) ) {
                    
                    
$old_date $ex1['time_stamp'];
                    
$new_date time();
                    
                    
$time_new $new_date $old_date;
                    
                    
$legna $ex1['legna'];
                    
$magazzino $ex1['magazzino'];
                    
                    
$premium $ex1['premium'];
                    
$civilta $ext1['civilta'];
                    
                    
$falegnami $ext2['falegnami'];
                    
                }
                
                if ( 
$this->time_new /*secondi*/ ) {
                
                    if ( 
$this->legna $this->magazzino ) {
                    
                        switch (
$this->civilta) {
                            
                            case 
greci:
                                
                                
$this->bonus "15,05,05";
                                break;
                            
                            case 
egizi:
                                
                                
$this->bonus "05,15,05";
                                break;
                            
                            case 
persiani:
                                
                                
$this->bonus "05,05,15";
                                break;
                            
                            case 
assiri:
                                
                                
$this->bonus "08,08,08";
                                break;
                            
                        }
                        
                        switch ( 
$this->premium) {
                        
                            case 
0:
                                
                                
$this->bonus_premium 1;
                                break;
                            
                            case 
1:
                                
                                
$this->bonus_premium 1.5;
                                break;
                            
                            case 
2:
                                
                                
$this->bonus_premium 2;
                                break;
                            
                            case 
3:
                                
                                
$this->bonus_premium 2.5;
                                break;
                        
                        }
                        
                        
$array_bonus explode(","$this->bonus);
                        
$alg1 = ( $this->falegnami 0.00555556 );
                        
$alg2 = ( ( $this->alg1 100 ) * $this->array_bonus );
                        
$alg3 = ( $this->alg1 $this->bonus_premium );
                        
$tot = ( $this->alg3 $this->alg2 );
                        
                        echo 
$array_bonus."

"
.$alg1."

"
.$alg2."

"
.$alg3."

"
.$tot;
                        
                        if ( 
$tot $this->magazzino ) {
                            
                            
mysql_query("UPDATE _utente SET legna = $this->tot, time_stamp = $this->time_stamp WHERE ID = $this->ID");
                        
                        } else {
                            
                            
mysql_query("UPDATE _utente SET legna = $this->magazzino, time_stamp = $this->time_stamp WHERE ID = $this->ID");
                        
                        }
                        
                    } else 
                    
                        
mysql_query("UPDATE _utente SET time_stamp = $this->time_stamp WHERE ID = $this->ID");
                    
                }
                    
            } else {
                
                return 
false;
            
            }
        
        }
    
    } 
E questa è la chiamata alla funzione nonché anche alla classe:

Codice PHP:
include "func.php";

    
$checkall = new CheckAll();
    
$checkall->checklegna(); 
l'ID l'ho impostato io manualmente per velocizzare i test. Il problema è che dovrebbe aggiornare il DB con i valori delle operazioni e sopratutto il time_stamp. Ma non fa niente di tutto ciò. Non capisco dove sta il problema, forse dichiaro male le variabili?