Codice PHP:
$selectn "SELECT max(id) AS id FROM ordini where status='si'";
$resultn mysql_query($selectn,$db);
$n mysql_result($resultn,$i,'id');
$n++;
$update='UPDATE tabella SET numero='.$n.' where id='.$id;
mysql_query ($update,$db); 
Non c'è bisogno del ciclo for.
Ci si aspetta un solo id comune a più record.
P.S. mysql_db_query() è una funzione deprecata. Meglio utilizzare mysql_query();