dynamic image, detail page link

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default dynamic image, detail page link

    I am building a dynamic online catalogue using php and mysql. The initial page
    has a name field, description and thumbnail. This part works well, including
    repeated regions etc. I have a link from the image going to a detail page where
    a more expanded version of the description are and a bigger image. But! If you
    click the link on no matter what image you have selected you only get the first
    detail page. How do I link the the page that relates to the item selected?

    Thanks

    Steve Lawrie Guest

  2. Similar Questions and Discussions

    1. ASP detail page "swap image" on click
      I am designing a site with master/detail ASP pages using an access data source. The Detail pages will display merchandise with the option to swap...
    2. dynamic detail pages
      anyone know how i can count the number of times each item in my access database is viewed? i have seen his before somewhere. also does anyone...
    3. Go To Detail Page Link
      Hi I have a small access database on my website that hold information on products that we sell. The User can run a product search on the database,...
    4. Can I open a page as a popup using GOTO DETAIL PAGE
      ok, i have posted this before but i didnt get any response. I have failed to find an answer anywhere else. I want to open a GOTO DETAIL page...
    5. Page Through Image with Direct Link
      Does anyone know of a cf tag that can do something similar to this page: http://www.alacasting.com/book6.asp Basically you choose a catalog and...
  3. #2

    Default Re: dynamic image, detail page link

    On 29 Mar 2005 in macromedia.dreamweaver.appdev, Steve Lawrie wrote:
    > I am building a dynamic online catalogue using php and mysql. The
    > initial page has a name field, description and thumbnail. This part
    > works well, including repeated regions etc. I have a link from the
    > image going to a detail page where a more expanded version of the
    > description are and a bigger image. But! If you click the link on no
    > matter what image you have selected you only get the first detail
    > page. How do I link the the page that relates to the item selected?
    The link needs to be a dynamic link, something like:

    <a href="detail.php?ID=<?php echo $itemid ?>
    <img src="<?php echo $itemphoto ?>">
    </a>

    where $itemid and $itemphoto are the information for the specific item
    from your database. Then on the page detail.php, you filter your
    recordset by the Query String. The recordset, in code, looks like:

    <?php
    $ID_Recordset1 = "1";
    if (isset($_GET['ID'])) {
    $ID_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
    }
    mysql_select_db($database_mydb, $mydb);
    $query_Recordset1 = sprintf("SELECT * FROM mytable WHERE Serial = %s", $ID_Recordset1);
    $Recordset1 = mysql_query($query_Recordset1, $mydb) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>

    --
    Joe Makowiec
    [url]http://makowiec.net/[/url]
    Email: [url]http://makowiec.net/email.php[/url]
    Joe Makowiec Guest

  4. #3

    Default Re: dynamic image, detail page link

    Hello Joe and thanks for your reply.

    The table I have created is called "product" and the columns are product_id,
    name, description, thumbnail, description_2 and image.

    In the initial page where the dynamic link is to be from the dynamic image, I
    installed the code you supplied,

    I am not certain if it's totally correct?

    on the detail page I edited the recordset to,

    Again I'm not sure if it is quite right. The server is unable to find the page
    detail.php

    Thanks again

    (initial page)
    <a href="-%3Ca%20href=%22detail.php?ID=<?php echo $product_id
    ?>%20-%3Cimg%20src=%22<?php echo $image ?>%22%3E%20-%3C/a%3E%20"><img
    src="thumb/<?php echo $row_qOnlineCat['thumbnail']; ?>"


    (detail page)
    <?php require_once('Connections/sculptured.php'); ?>
    <?php
    $ID_qDetail = "1";
    if (isset($_GET['ID'])) {
    $ID_qDetail = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
    mysql_select_db($database_sculptured, $sculptured);
    $query_qDetail = "SELECT description_2, image FROM product";
    $qDetail = mysql_query($query_qDetail, $sculptured) or die(mysql_error());
    $row_qDetail = mysql_fetch_assoc($qDetail);
    $totalRows_qDetail = mysql_num_rows($qDetail);
    ?>

    Steve Lawrie Guest

  5. #4

    Default Re: dynamic image, detail page link

    On 31 Mar 2005 in macromedia.dreamweaver.appdev, Steve Lawrie wrote:
    > The table I have created is called "product" and the columns are
    > product_id, name, description, thumbnail, description_2 and image.
    >
    > In the initial page where the dynamic link is to be from the dynamic
    > image, I installed the code you supplied,
    >
    > I am not certain if it's totally correct?
    >
    > on the detail page I edited the recordset to,
    >
    > Again I'm not sure if it is quite right. The server is unable to
    > find the page detail.php
    >
    > Thanks again
    >
    > (initial page)
    > <a href="-%3Ca%20href=%22detail.php?ID=<?php echo $product_id
    > ?>%20-%3Cimg%20src=%22<?php echo $image
    > ?>%22%3E%20-%3C/a%3E%20"><img src="thumb/<?php echo
    > $row_qOnlineCat['thumbnail']; ?>"
    >
    >
    > (detail page)
    > <?php require_once('Connections/sculptured.php'); ?>
    > <?php
    > $ID_qDetail = "1";
    > if (isset($_GET['ID'])) {
    > $ID_qDetail = (get_magic_quotes_gpc()) ? $_GET['ID'] :
    > addslashes($_GET['ID']); mysql_select_db($database_sculptured,
    > $sculptured); $query_qDetail = "SELECT description_2, image FROM
    > product"; $qDetail = mysql_query($query_qDetail, $sculptured) or
    > die(mysql_error()); $row_qDetail = mysql_fetch_assoc($qDetail);
    > $totalRows_qDetail = mysql_num_rows($qDetail);
    > ?>
    It's hard to tell based on what you posted what's going on. However:

    - Did you create a detail.php page? Is it in the directory it's supposed
    to be in?
    - In the recordset in the detail page, you also need a WHERE clause. See
    [url]http://makowiec.net/test/recordset.gif[/url] to see the setup for a recordset
    with a dynamic parameter.

    If this doesn't help, could you:
    - post a link to the pages in question
    - copy the pages to [pagename].php.txt and post those so we can see the
    code?

    --
    Joe Makowiec
    [url]http://makowiec.net/[/url]
    Email: [url]http://makowiec.net/email.php[/url]
    Joe Makowiec Guest

  6. #5

    Default Re: dynamic image, detail page link

    Hello Joe,

    Thank you for your help so far. Sorry that I am late answering but I had grief
    with the domain provider. All sorted now.

    I am still having problems with this issue and as you suggested I'll give you
    the links so you can have a look.

    [url]http://www.sculpturedlight.com/enquire.php[/url]

    and

    [url]http://www.sculpturedlight.com/detail.php[/url]

    Thanks you again

    Steve Lawrie Guest

  7. #6

    Default Re: dynamic image, detail page link

    Woops one of the links is wrong!

    ;
    }
    mysql_select_db($database_new_sculpture, $new_sculpture);
    $query_qdetail = "SELECT product_id, name, description_2, image FROM product";
    $qdetail = mysql_query($query_qdetail, $new_sculpture) or die(mysql_error());
    $row_qdetail = mysql_fetch_assoc($qdetail);
    $totalRows_qdetail = mysql_num_rows($qdetail);
    ?>

    I am new to PHP but I think I'm close to what's required. If I'm way off the
    mark please let me know.

    Thanks

    Steve Lawrie Guest

  8. #7

    Default Re: dynamic image, detail page link

    Hello Joe
    And thanks for your email.

    I did the fix that you suggested:
    <?php
    $ID_qDetail = "1";
    if (isset($_GET['ID'])) {
    $ID_qDetail = (get_magic_quotes_gpc()) ? $_GET['ID'] :
    addslashes($_GET['ID']);
    }
    mysql_select_db($database_new_sculpture, $new_sculpture);
    $query_qDetail = sprintf("SELECT product_id, name, description_2, image WHERE
    product_id = %s", $ID_qDetail);
    $qDetail = mysql_query($query_qDetail, $new_sculpture) or die(mysql_error());
    $row_qDetail = mysql_fetch_assoc($qDetail);
    $totalRows_qDetail = mysql_num_rows($qDetail);
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Detail Page</title>
    <link href="light.css" rel="stylesheet" type="text/css">
    </head>

    But I still get the reply:

    You have an error in your SQL syntax; check the manual that corresponds to
    your MySQL server version for the right syntax to use near 'WHERE product_id =
    ' at line 1

    I am sure the mysql database is ok.

    mysql> select * from product;

    +------------+-----------+--------------------------+-------------+-------------
    ---------------------------------------------------------+-------------+
    | product_id | name | description | thumbnail |
    description_2 | image
    |

    +------------+-----------+--------------------------+-------------+-------------
    ---------------------------------------------------------+-------------+
    | 1 | Dashboard | Dashboard of antique car | dash_s.jpg | Close up
    of the dashboard of an antique car at a show in Hervey Bay. | dash_l.jpg |
    | 2 | Pivot | Pivot irrigation | pivot_s.jpg | Photo of
    pivot cane irrigation in Maryborough, Queensland. | pivot_l.jpg |

    +------------+-----------+--------------------------+-------------+-------------
    ---------------------------------------------------------+-------------+

    Thanks for your help.

    Steve

    Steve Lawrie Guest

  9. #8

    Default Re: dynamic image, detail page link

    Hello,

    I changed the line to:

    $query_qDetail = sprintf("SELECT product_id, name, description_2, image FROM
    product WHERE product_id = %s", $colname_qDetail);

    in the recordset on the detail.php page. I just cut and pasted it in, I hope
    that doesn't effect the page but I still get the same error.

    Steve Lawrie Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139