Código PHP:
$registros=mysql_query("select * from regmate where matricula=$matricula",$link)
$ses=$reg['session'];
$re=mysql_query("select * from sessiones where idsession='$ses'",$link) or
die("Problemas en el select:".mysql_error());
$r=mysql_fetch_array($re);
$dias=$r['dia'];