Skip navigation
Currently Being Moderated

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

Oct 12, 2011 11:22 AM

Tags: #dreamweaver_cs5.5

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

 
Replies
  • Currently Being Moderated
    Oct 12, 2011 12:19 PM   in reply to anshekerman

    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"].

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 13, 2011 5:29 AM   in reply to anshekerman

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 15, 2011 9:15 AM   in reply to anshekerman

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 15, 2011 10:28 PM   in reply to anshekerman

    >You are right: it works.

    >But I don'n know how to make Dreamweaver make

    >these curly qoutes; I copied en pasted them from Word

    >and that is a lot of work!?

     

    So you are saying that if you manually type in single quotes around a word in DW, it is creating curly quotes?

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 17, 2011 11:23 AM   in reply to anshekerman

    Dreamweaver DOES NOT put curly quotes into your code.  Ever.  It does not have the ability to do a curly quote as anything other than an HTML entity, e.g.,

     

    "

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 17, 2011 3:28 PM   in reply to anshekerman

    That's exactly what I'm disputing.  There is no mechanism to have DW produce non-7bit-ascii quotes as anything other than an HTML entity.  DW is not a word processor. DW did not produce those characters.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 17, 2011 3:36 PM   in reply to anshekerman

    >Dreamweaver produced code that

    >gave a syntax-error report, as I told in this discussion.

     

    What operating system are you running? What language? Have you installed any utilities that might have altered the character set?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points