Skip to main content
Participating Frequently
March 28, 2011
Answered

Master Detail Page Set issue

  • March 28, 2011
  • 1 reply
  • 2140 views

I hope I'm in the right forum.  Apology if this doesn't belong in this category.


I've created master detail page sest previously.  Theyr'e actuallly quite straightforward.


Most recent experience different.  Master page is good.  I think.


Problem is with the detail page not displaying the fields I selected.  What appears instead is a very brief message:


Unknown column 'JGER' in 'where clause'


The JGER is part of an item code for a piece of jewelry.  The complete code for this particular piece is JGER-IC00330.JPG.


I've compared earlier sets of fully functioning master detail pages with the new one I'm trying to create.  Compared the codes, compared what appears in the bindings & server behavior panels.  Have also compared the MySQL tables in the database.  It's the same database, but different tables.


I'm clearly missing someting.  At this writing I remain baffled.


Anyone else experienced this?

This topic has been closed for replies.
Correct answer Günter_Schenk

Thank you for your help.  Simple fix: No spaces in table or field names.  Everything works as advertised.

Much appreciated.


Thanks for reporting !

I´m marking this thread as assumed answered.

1 reply

Günter_Schenk
Inspiring
March 28, 2011

Can you post the query code of both pages ? Without this information we´ll be in the dark ;-)

Participating Frequently
March 28, 2011

Here's the PHP code on the master page:

<?php require_once('Connections/jewelry.php'); ?>

<?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

  if (PHP_VERSION < 6) {

    $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_rsFaithcollection = 1;

$pageNum_rsFaithcollection = 0;

if (isset($_GET['pageNum_rsFaithcollection'])) {

  $pageNum_rsFaithcollection = $_GET['pageNum_rsFaithcollection'];

}

$startRow_rsFaithcollection = $pageNum_rsFaithcollection * $maxRows_rsFaithcollection;

mysql_select_db($database_jewelry, $jewelry);

$query_rsFaithcollection = "SELECT ID, image, title, `description`, price, cart, length, `earring drop` FROM `faith collection`";

$query_limit_rsFaithcollection = sprintf("%s LIMIT %d, %d", $query_rsFaithcollection, $startRow_rsFaithcollection, $maxRows_rsFaithcollection);

$rsFaithcollection = mysql_query($query_limit_rsFaithcollection, $jewelry) or die(mysql_error());

$row_rsFaithcollection = mysql_fetch_assoc($rsFaithcollection);

if (isset($_GET['totalRows_rsFaithcollection'])) {

  $totalRows_rsFaithcollection = $_GET['totalRows_rsFaithcollection'];

} else {

  $all_rsFaithcollection = mysql_query($query_rsFaithcollection);

  $totalRows_rsFaithcollection = mysql_num_rows($all_rsFaithcollection);

}

$totalPages_rsFaithcollection = ceil($totalRows_rsFaithcollection/$maxRows_rsFaithcollection)-1;

$queryString_rsFaithcollection = "";

if (!empty($_SERVER['QUERY_STRING'])) {

  $params = explode("&", $_SERVER['QUERY_STRING']);

  $newParams = array();

  foreach ($params as $param) {

    if (stristr($param, "pageNum_rsFaithcollection") == false &&

        stristr($param, "totalRows_rsFaithcollection") == false) {

      array_push($newParams, $param);

    }

  }

  if (count($newParams) != 0) {

    $queryString_rsFaithcollection = "&" . htmlentities(implode("&", $newParams));

  }

}

$queryString_rsFaithcollection = sprintf("&totalRows_rsFaithcollection=%d%s", $totalRows_rsFaithcollection, $queryString_rsFaithcollection);

?>

Tha last bit of code floows the closing </html>.

Here's the code on the PHP page:

<?php require_once('Connections/jewelry.php'); ?><?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

  if (PHP_VERSION < 6) {

    $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;

}

}

$maxRows_DetailRS1 = 1;

$pageNum_DetailRS1 = 0;

if (isset($_GET['pageNum_DetailRS1'])) {

  $pageNum_DetailRS1 = $_GET['pageNum_DetailRS1'];

}

$startRow_DetailRS1 = $pageNum_DetailRS1 * $maxRows_DetailRS1;

$colname_DetailRS1 = "-1";

if (isset($_GET['recordID'])) {

  $colname_DetailRS1 = $_GET['recordID'];

}

mysql_select_db($database_jewelry, $jewelry);

$query_DetailRS1 = sprintf("SELECT ID, image, title, `description`, price, cart, length, `earring drop` FROM `faith collection` WHERE ID = %s", GetSQLValueString($colname_DetailRS1, "-1"));

$query_limit_DetailRS1 = sprintf("%s LIMIT %d, %d", $query_DetailRS1, $startRow_DetailRS1, $maxRows_DetailRS1);

$DetailRS1 = mysql_query($query_limit_DetailRS1, $jewelry) or die(mysql_error());

$row_DetailRS1 = mysql_fetch_assoc($DetailRS1);

if (isset($_GET['totalRows_DetailRS1'])) {

  $totalRows_DetailRS1 = $_GET['totalRows_DetailRS1'];

} else {

  $all_DetailRS1 = mysql_query($query_DetailRS1);

  $totalRows_DetailRS1 = mysql_num_rows($all_DetailRS1);

}

$totalPages_DetailRS1 = ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1;

?>

This follows immediately after the closing </html>:

<?php

mysql_free_result($DetailRS1);

?>

Appreciate any & all help.

Günter_Schenk
Inspiring
March 29, 2011

I assume that this issue stems from using table and column names (earring drop, faith collection) which contain spaces, what´s not allowed and usually leads to unpredictable problems when a query gets executed.

This needs to be fixed, and the only allowed delimiter is an underscore (earring_drop, faith_collection)