PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
$mysql_id = mysql_connect('localhost', 'xxx', 'xxx');
mysql_select_db('mariolopes',$mysql_id);
session_start();
$aluno=$_SESSION['nome'];
//--regista as horas na base de dados
$query="INSERT INTO registo_horas (Aluno,Data,N_horas,Confirmado) VALUES ('$aluno',$_POST[data],'$_POST[horas]','N')";
$result=mysql_query($query);
if(!$result){
echo mysql_error();
}
$query="select sum(N_horas) as total from registo_horas";
$result=mysql_query($query);
session_start();
while($row=mysql_fetch_array($result)){
$_SESSION['horas']=$row['total'];
}
header( 'Location= registohoras.php');
?>
Because that's not how you specify a location header. 'Location: url'
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.