DreamWeaver has now created a "detail.php" page (you could have called it anything.php too) as well as inserted repeating dynamic tables in the "master.php" file and a single table with recordset bindings in "detail.php." Save both of these files and upload them as well as the "Connections" folder to the root directory of your site. Point your browser to www.mydomain.com/master.php and view your items. Click on the Image hyperlink and you'll be taken to the detail.php page and see only the information about the item you selected from the master page. Go back, click a different item and the same page will show up with different information. What about the image links? At this point your database has image locations (URL) of where the images for your "Catalog" exist. In order to show the images instead of the image URL's, you will have to alter the Hyperlink in the master.php code: <a href="detail.php?recordID=<?php echo $row_stuff['id']; ?>"><?php echo $row_stuff['image_loc']; ?> </a> Simply highlite the "stuff.img_loc" blue link in your design view and it will reveal itself in the "code view" In order to show the image you will have to enter some HTML and PHP code. Here is the breakdown: - <a href="detail.php?recordID=<?php echo $row_stuff['id']; ?>"> :: This is the first part of the hyperlink that tells the link where to go which is detail.php. There are other parameters that tell what ID number has been selected and which row from the table "items" to send to detail.php.
- <?php echo $row_stuff['image_loc']; ?> </a> :: This is the second portion that is telling what information to display from the database table field "image_loc". Since it's just a word, it will display the VARCHAR you entered into the database table.
What you need to type: Since there is no "img src="" tag, which would display and image, you need to enter the following in front of <?php echo $row_stuff['image_loc']; ?> </a> Which looks like this: <img src="<?php echo $row_stuff['image_loc']; ?>" /></a> The complete line should be: <a href="detail.php?recordID=<?php echo $row_stuff['id']; ?>"><img src="<?php echo $row_stuff['image_loc']; ?>" /></a> The "wrapping" of this HTML tag around the PHP code signifying where the image exists will convert the text in the database table and treat it as an actual text link. Try it out! You can alter the img tag to have no border, and you can change the size of the img Height and Width to show a smaller version of the image in the master.php display. Add this code to the detail.php image location recordset as well so that you see one image for both pages. You can even add an additional field in your database that is called "thumb_image" and upload smaller versions of the images supplied in the ZIP file from this tutorial. |