quando una query ti "fallisce" e vuoi conoscere il perchè nel die imposta la funzione mysql_error()
Codice PHP:
$updateuser="update materie set lun='$userlun', mar='$usermar' where id='$id'"; mysql_query($updateuser)
or die("Impossibile eseguire l'operazione per il seguente motivo:" mysql_error());