Why is my detail page blank with no data from master page?

I created master page that links to detail page - but when I click on the link I see the detail page empty from data.
Do you know why? Thanks!
This is the PHP code I'm using in the detail page:
<?php require_once('../Connections/connection1.php'); ?>
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  return $theValue;
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "formUpdateSale")) {
  $updateSQL = sprintf("UPDATE neve_sale SET type=%s, area=%s, address=%s, built=%s, lot=%s, BR=%s, floor=%s, floorAll=%s, parking=%s, elevator=%s, price=%s, available=%s, `date`=%s, status=%s, details=%s, myDetails=%s, pic1=%s, pic2=%s, pic3=%s, pic4=%s, pic5=%s WHERE `primary`=%s",
                       GetSQLValueString($_POST['type'], "text"),
                       GetSQLValueString($_POST['area'], "text"),
                       GetSQLValueString($_POST['address'], "text"),
                       GetSQLValueString($_POST['built'], "int"),
                       GetSQLValueString($_POST['lot'], "int"),
                       GetSQLValueString($_POST['BR'], "int"),
                       GetSQLValueString($_POST['floor'], "int"),
                       GetSQLValueString($_POST['floorAll'], "int"),
                       GetSQLValueString($_POST['parking'], "text"),
                       GetSQLValueString($_POST['elevator'], "text"),
                       GetSQLValueString($_POST['price'], "int"),
                       GetSQLValueString($_POST['available'], "text"),
                       GetSQLValueString($_POST['date'], "date"),
                       GetSQLValueString($_POST['status'], "text"),
                       GetSQLValueString($_POST['details'], "text"),
                       GetSQLValueString($_POST['myDetails'], "text"),
                       GetSQLValueString($_POST['pic1'], "text"),
                       GetSQLValueString($_POST['pic2'], "text"),
                       GetSQLValueString($_POST['pic3'], "text"),
                       GetSQLValueString($_POST['pic4'], "text"),
                       GetSQLValueString($_POST['pic5'], "text"),
                       GetSQLValueString($_POST['primary'], "int"));
  mysql_select_db($database_connection1, $connection1);
  $Result1 = mysql_query($updateSQL, $connection1) or die(mysql_error());
  $updateGoTo = "admin-sales1.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  header(sprintf("Location: %s", $updateGoTo));
$colname_Recordset1 = "-1";
if (isset($_GET['primary'])) {
  $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['primary'] : addslashes($_GET['primary']);
mysql_select_db($database_connection1, $connection1);
$query_Recordset1 = sprintf("SELECT * FROM neve_sale WHERE `primary` = %s", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $connection1) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

11) opened iPhoto library package and I now have 'old masters' and 'Masters'
12) several years seem to be missing from these two folders
You got bitten by a nasty bug.
The upgrade of your library got interrupted, and some of your photos are still in the "Old ..." folders.  There is no known fix for this, that can save your iPhoto library. We are still waiting for a bug fix from Apple. What you can do, copy out your original photos, that are still in the "Old Masters" and "Masters", and save these folders.
Then restore your library from your most recent backup and use the saved "Old " folders  to reimport and add the newest photos, that are missing in your backup.
The "years" folders in "Masters" and "Old Masters"  are the years, when the photos have been imported, not necessarily the years when the photos have been taken.