Ask a Question related to Dreamweaver AppDev, Design and Development.
-
Steve Lawrie #1
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
-
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... -
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... -
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,... -
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... -
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... -
Joe Makowiec #2
Re: dynamic image, detail page link
On 29 Mar 2005 in macromedia.dreamweaver.appdev, Steve Lawrie wrote:
The link needs to be a dynamic link, something like:> 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?
<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
-
Steve Lawrie #3
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
-
Joe Makowiec #4
Re: dynamic image, detail page link
On 31 Mar 2005 in macromedia.dreamweaver.appdev, Steve Lawrie wrote:
It's hard to tell based on what you posted what's going on. However:> 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);
> ?>
- 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
-
Steve Lawrie #5
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
-
Steve Lawrie #6
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
-
Steve Lawrie #7
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
-
Steve Lawrie #8
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



Reply With Quote

