Page 1 of 1

problem in syntax?

Posted: Tue May 27, 2008 1:50 am
by darren713
hello i got this pain in the *** problem. i am building a database and am linking my pages up. the problem i got is i am trying to link the master page up with the details page. i have to my knowladge used all the correct syntax regarding the URL PARAMETER in the master page and the recordset in the details page.

The problem i am getting is i cant seem to view any of the data in the details page. for example when linking my dynamic table content up with the rsdetails recordset in the details page i am using this url papameter in my properties inspector.

customerdetails.php?recordID=<?php echo $row_rsdetails['FirstName']; ?>

my recordset in the details page is as follows.

Code: Select all

<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
$currentPage = $_SERVER["PHP_SELF"];
 
$maxRows_Customers = 10;
$pageNum_Customers = 0;
if (isset($_GET['pageNum_Customers'])) {
  $pageNum_Customers = $_GET['pageNum_Customers'];
}
$startRow_Customers = $pageNum_Customers * $maxRows_Customers;
 
mysql_select_db($database_pm, $pm);
$query_Customers = "SELECT * FROM Customers";
$query_limit_Customers = sprintf("%s LIMIT %d, %d", $query_Customers, $startRow_Customers, $maxRows_Customers);
$Customers = mysql_query($query_limit_Customers, $pm) or die(mysql_error());
$row_Customers = mysql_fetch_assoc($Customers);
 
if (isset($_GET['totalRows_Customers'])) {
  $totalRows_Customers = $_GET['totalRows_Customers'];
} else {
  $all_Customers = mysql_query($query_Customers);
  $totalRows_Customers = mysql_num_rows($all_Customers);
}
$totalPages_Customers = ceil($totalRows_Customers/$maxRows_Customers)-1;
 
$colname_rsdetails = "-1";
if (isset($_GET['recordID'])) {
  $colname_rsdetails = $_GET['recordID'];
}
mysql_select_db($database_pm, $pm);
$query_rsdetails = sprintf("SELECT * FROM Customers WHERE id = %s", GetSQLValueString($colname_rsdetails, "int"));
$rsdetails = mysql_query($query_rsdetails, $pm) or die(mysql_error());
$row_rsdetails = mysql_fetch_assoc($rsdetails);
$totalRows_rsdetails = mysql_num_rows($rsdetails);
 
$queryString_Customers = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Customers") == false && 
        stristr($param, "totalRows_Customers") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_Customers = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_Customers = sprintf("&totalRows_Customers=%d%s", $totalRows_Customers, $queryString_Customers);
?>
then dragging and dropping the dynamic text in the page from the applications panel.
Like i said to me the syntax looks ok but then i could be wrong.

Re: problem in syntax?

Posted: Thu May 29, 2008 11:49 pm
by califdon

Code: Select all

customerdetails.php?recordID=<?php echo $row_rsdetails['FirstName']; ?>
Are you really using the field 'FirstName' as your recordID???

Re: problem in syntax?

Posted: Fri May 30, 2008 8:47 pm
by darren713
ive tried a few for recordID, i have tried, just ID, i have tried CODE and i put the firstname for reference but still i get the same problem