Hiya,
got a little prob with the syntax for
header ( ' Location .... with variable).
Usually examples are given with a complete URL, like:
..... header( 'Location: login/testsite/start.php' );
I'd like to use particular read out data from my database (URL)
(variable $result).
..... header( 'Location: $result' ); ?????
$result is not a string but an array
see below in code: $result=mysql_f etch_array($sql request);
Thanx in anticipation!
Code
<?php
session_start ();
if(isset($_POST['password'])
AND
strcmp(trim($_P OST['password']),'') != 0 )
$dbID=mysql_con nect ('localhost', 'root') or die(mysql_error ());
mysql_select_db ('login', $dbID)or die(mysql_error ());
$sqlZiel="SELEC T destination FROM passwordrequest WHERE password = '101TR'";
//'101TR' (example)
$sqlrequest=mys ql_query($sqlde stination)or die(mysql_error ());
$Ergebnis=mysql _fetch_array($s qlrequest);
mysql_close();
//print_r ($result);
if(isset($resul t))
{
header("Locatio n: ($result)");
//header( 'Location: testsite/start.php' );
exit();
}
else
{
header( 'Location: http://localhost/login/IDfailure.php' );
exit();
}
?>
got a little prob with the syntax for
header ( ' Location .... with variable).
Usually examples are given with a complete URL, like:
..... header( 'Location: login/testsite/start.php' );
I'd like to use particular read out data from my database (URL)
(variable $result).
..... header( 'Location: $result' ); ?????
$result is not a string but an array
see below in code: $result=mysql_f etch_array($sql request);
Thanx in anticipation!
Code
<?php
session_start ();
if(isset($_POST['password'])
AND
strcmp(trim($_P OST['password']),'') != 0 )
$dbID=mysql_con nect ('localhost', 'root') or die(mysql_error ());
mysql_select_db ('login', $dbID)or die(mysql_error ());
$sqlZiel="SELEC T destination FROM passwordrequest WHERE password = '101TR'";
//'101TR' (example)
$sqlrequest=mys ql_query($sqlde stination)or die(mysql_error ());
$Ergebnis=mysql _fetch_array($s qlrequest);
mysql_close();
//print_r ($result);
if(isset($resul t))
{
header("Locatio n: ($result)");
//header( 'Location: testsite/start.php' );
exit();
}
else
{
header( 'Location: http://localhost/login/IDfailure.php' );
exit();
}
?>
Comment