When i upload this file on the browser, it isnt displayed but exits to the error file that i have. There is something wrong with if(!isset() part of the code, but im not sure what?
Can someone help and tell me if theres another way of rewritting the line highlighted in red below or whats even wrong with this? as it exits at the header("location:error.php"); part. and this error.php file displays a message :
"Unfortunately an error has occured! Please follow the link back to the main page to try again"
This is only part of the code.
<?
include 'db_param.php';
include 'common.php';
if (!isset ($p_id) || $p_id == "")
{
header("Location:error.php");
exit;
}
$link = mysql_connect($db_h, $db_u, $db_p) or exit ("Unable to connect!");
mysql_select_db($db) or exit ("Could not connect to database!");
$sql = "SELECT fname, lname, dob, addr1, addr2, city, county, pcode, phone, email, posted from personal WHERE p_id = '$p_id'";
$query = mysql_query($sql) or exit ("Error in query: $sql. " . mysql_error());
if (mysql_num_rows($query) <= 0)
{
header("Location:error.php");
exit;
}
else
{
list($fname, $lname, $dob, $addr1, $addr2, $city, $county, $pcode, $phone, $email, $posted) = mysql_fetch_row($query);
?>