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
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.
I copied en pasted them from Word
That's the problem right there. Murray's right. You copied something from Word that you shouldn't have. When you are working with code especially don't copy and paste from a word processing application. Even textedit or notepad would be better than Word in this case.
I can manually type in double brackets, like this:
$varProduct_rsDetails = "1";
if (isset($_GET["productID"])) {
$varProduct_rsDetails = $_GET["productID"];
}
this is accepted; no syntax-error report.
I can manually type in single brackets, like this:
$varProduct_rsDetails = "1";
if (isset($_GET['productID'])) {
$varProduct_rsDetails = $_GET['productID'];
}
this is also accepted; no syntax-error report.
Dreamweaver itself made this code:
$varProduct_rsDetails = "32";
if (isset($_GET[‘productID’])) {
$varProduct_rsDetails = $_GET[‘productID’];
}
this was not OK; there was a syntax-error report.
But strange enough, when I do paste this now from here, it is accepted.
So the problem has been, that DW created code that gave a syntax error.
I could repair it by replacing the single qoutes of DW, by typing single quotes in DW manually, or by typing in in DW manually double qoutes!!!
So maybe everybode was right!!!
But is was a very bad problem; maybe a "bug" of the program?
I repeated this about 10 times before I got the solution frome this Forum.
North America
Europe, Middle East and Africa
Asia Pacific