Alright so I’m trying to create a redirect script where it determines where to direct the user based on what the column equals to. Can anyone please “direct” me in how to accomplish this? This what I have so far:
[php]<?
include(‘config.php’);
include(‘lock.php’);
include(‘timeout.php’);
$db_name=""; // Database name
$tbl_name=""; // Table name
// Connect to server and select database.
mysql_select_db("$db_name")or die(“cannot select DB”);
// get value of id that sent from address bar
$id=$_GET[‘id’];
// Retrieve data from database
$sql=“SELECT * FROM $tbl_name WHERE id=’$id’”;
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
$a = “apteditform.php?id=”.$rows[‘id’]."";
$b = “commeditform.php?id=”.$rows[‘id’]."";
$unit = “”.$rows[‘unit’]."";
if ( “$unit == ‘Apartment’” )
{
header (“Location: $a”);
}
elseif ( “$unit == ‘Commercial’” )
{
header (“Location: $b”);
}
?>[/php]
Thanks