can anybody figure out why header("location: $address"); in first case doesn't pass $address row retrieved from the database by looking at this code? or any other possible way to retrieve $address from the mysql table?
[PHP
<?
include("ibf.inc.php");
protect("3"); //allow access to member groups 1 and 4 (admins and members only)
//end of protection code
function protect($groups) {
global $ibforums;
$allowed=false;
$newgroups=split(",",$groups);
foreach($newgroups as $value) {
if ($value==$ibforums->member['mgroup']) {
if ($ibforums->member['posts'] / ((time()-$ibforums->member['joined'])/86400) >= 5) {
//code to download file
$db_name = "database_name";
$table_name = "table_name";
$cnx = mysql_connect("localhost", "username", "password")
or die("Couldn't connect.");
$db = mysql_select_db($db_name, $cnx)
or die("Couldn't select database.");
$sql = "SELECT id, address FROM $table_name
WHERE id = '$id'";
$result = mysql_query($sql,$cnx)
or die("Couldn't execute query.");
while ($row = @mysql_fetch_array($result)) {
$id = $row["id"];
$address = $row["address"];
}
header("location: $address");
} else {
//code to send message not enough posts per day
echo "you are logged in, but don't have at least 5 posts per day";
}
} else {
//failed code (aka not in member group)
echo "you are either not logged in or are not in any member group";
exit();
}
}
}
?>
[/code]
can anybody figure out why header("location: $address"); in first case doesn't pass $address row retrieved from the database by looking at this code? or any other possible way to retrieve $address from the mysql table?