Skip to main content
Participating Frequently
October 12, 2011
Answered

Tutorial Dreamweaver Cs5.5 The Missing Manual (Pg 998 - 1018) about adding dynamic data to your page

  • October 12, 2011
  • 1 reply
  • 3562 views

Hallo,

I did Tutorial: Displaying Database Info in the Missing Manual for Dreamweaver CS5.5.

My problem is with "Editing a Recordset and Linking to a Detail Page" (which starts at pg 1002:

I did this exercise ,over 5 times nowe, but every time with "Building the Detailed Product Page" at pg 1007, I get a bad result.

I only get one page (the default one with productID = 1) for every link on the indexpage.

In the adressbar (Live View) I see the right adress: for example: http://localhost/cos...hp?productID=16, but for all productID's only the detailspage for productID are shown.

There is also a message: Notice: Use of undefined constant ‘productID’ - assumed '‘productID’' in E:\xampp\htdocs\cosmo_shop\product.php on line 34

But I don't understand what could be wrong in this line.

Here is the code lines 33 -48: is is about the second line:

$varProduct_rsDetails = "32";
if (isset($_GET[‘productID’])) {
  $varProduct_rsDetails = $_GET[‘productID’];
}
mysql_select_db($database_connCosmo, $connCosmo);
$query_rsDetails = sprintf("SELECT products.productID, products.productName, products.price, products.`description`, products.inventory, products.image, vendors.vendorName FROM products, vendors WHERE products.vendorID = vendors.vendorID AND products.productID = %s ", GetSQLValueString($varProduct_rsDetails, "int"));
$rsDetails = mysql_query($query_rsDetails, $connCosmo) or die(mysql_error());
$row_rsDetails = mysql_fetch_assoc($rsDetails);
$totalRows_rsDetails = mysql_num_rows($rsDetails);

mysql_select_db($database_connCosmo, $connCosmo);
$query_rsCategories = "SELECT * FROM categories ORDER BY categoryName ASC";
$rsCategories = mysql_query($query_rsCategories, $connCosmo) or die(mysql_error());
$row_rsCategories = mysql_fetch_assoc($rsCategories);
$totalRows_rsCategories = mysql_num_rows($rsCategories);
?>

Can someone tell me what is going on here?

Kind regards, Ans Hekerman

This topic has been closed for replies.
Correct answer Ben M

Normally an undefined constant is if you have something like

$var[sometext]

Where the "sometext" is not quoted.  Try changing the single quote around the productID to a double quote eg: $_GET["productID"].

1 reply

Ben MCommunity ExpertCorrect answer
Community Expert
October 12, 2011

Normally an undefined constant is if you have something like

$var[sometext]

Where the "sometext" is not quoted.  Try changing the single quote around the productID to a double quote eg: $_GET["productID"].

Participating Frequently
October 13, 2011

It works: I am HAPPY!!!!

I changed the code to this:

$varProduct_rsDetails = "32";

if (isset($_GET["productID"])) {

  $varProduct_rsDetails = $_GET["productID"];

}

MurraySummers
Inspiring
October 13, 2011

Actually, I think the issue was this - look carefully at the red content in your post.  It appears that you have used CURLY QUOTES to encapsulate the productID variable.  That would cause the error you are getting since curly quotes are not legal delimiters.  I'll bet if you go back to that line and replace the double quotes with legal single quotes, it'll continue to work.  THere's no difference between those two legal quote types when used to encapsulate variable names.