Page 1 of 1

Location does not work

Posted: Wed Feb 03, 2010 10:49 am
by mariolopes
In the following code:

Code: Select all

 
<?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');
?>
 
The location does not redirect my webpage. Why?

Re: Location does not work

Posted: Wed Feb 03, 2010 11:02 am
by AbraCadaver
Because that's not how you specify a location header. 'Location: url'

Re: Location does not work

Posted: Thu Feb 04, 2010 3:58 am
by mariolopes
Right
Thank you