mi sono fatto un db di test dove ho importato la tabella delle potenze, così posso fare tutti i test che voglio in un ambiente "pulito".

riporto tutto il codice cosi forse si capisce dove sbaglio:

Codice PHP:
// Collegamento al DB    
     
$db mysql_connect ('localhost''root','') or die ('nun se collega');
     
mysql_select_db ('test'$db) or die (mysql_error ($db));

//Query per la selezione dei dati 
$query 'SELECT * FROM tab_potenze'
$result mysql_query ($query$db) or die (mysql_error ($db));
  
//estrazione dei dati  
  
while ($row mysql_fetch_assoc ($result)) {
  
extract ($row)                                       ;
  echo 
'<tr>'                                          ;
  echo 
"<td align = 'center'>$id -- PM=$potenza_m  PS=$potenza_s Stato=$stato</td>
"    
;
                                          } 
                                       
    
 
//caso 1  
  
IF ($potenza_m>and $potenza_s>0) { 
  
$query2="UPDATE tab_potenze SET stato =1 WHERE id= $id;  
  
$result2 mysql_query ($query2$db) or die (mysql_error ($db));   
  } 
//caso 2 
  
ELSEIF ($potenza_m==and $potenza_s==0)    { 
  
$query2="UPDATE tab_potenze SET stato =2 WHERE id= $id;  
  
$result2 mysql_query ($query2$db) or die (mysql_error ($db));   
  
  } 
il risultato che ottengo è il seguente:

1 -- PM=256.20 PS=246.50 Stato=5
2 -- PM=166.10 PS=278.50 Stato=5
3 -- PM=278.50 PS=280.70 Stato=5
4 -- PM=0.00 PS=0.00 Stato=5
5 -- PM=379.70 PS=379.40 Stato=5

cioè non mi fa il controllo e non imposta correttamente lo stato.