Location does not work

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!

Moderator: General Moderators

Post Reply
mariolopes
Forum Contributor
Posts: 102
Joined: Sun May 22, 2005 7:08 am

Location does not work

Post 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?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Location does not work

Post by AbraCadaver »

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.
mariolopes
Forum Contributor
Posts: 102
Joined: Sun May 22, 2005 7:08 am

Re: Location does not work

Post by mariolopes »

Right
Thank you
Post Reply