0

Hi All,
I have a table with retrieves an image from the database table item, and displays it in a column within a table(for each product-ISBN). I want to be able to show additional images for each row in a table. For example, i would like a hyperlink under the main image which i have displayed, when clicked shows the back of the product as an image.

Is this possible to do? I want to show the front and back of a product, please could you give an example as to how this can be done.

Thanks, any help will be appreciated
Susan

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by Susan.LK
0

I'm assuming you're getting both front cover and back cover from the database. For each row you could use javascript to flip between both images.

To get you started, here's how you would switch to another image:

<a href="" onClick="document.cover.src='backcover.jpg';">
<img src="frontcover.jpg" name="cover">
</a>
0

Thank you for the feedback radios4rabbits and BzzBee, currently the way an image is being displayed is by the use of the following code and table:

Table: Book: ISBN, title, image1, image2, image3
image1,2 and 3: are blob datatype which stores the files path in tags <img src=""/>

My Php script: selects image frm the database for the inputted title and displayes in the first column of the table..

.....
if($result){
echo' <table align="center" border="1">
<tr> 
<td> Image1</td>
<td>ISBN</td>
...
</tr>
while ($row = mysql_fetch_array ($results, MYSQL_ASSOC)){
echo '<tr>
       <td>'.  $row['image1']. '</td>
  <td>'.  $row['ISBN]. '</td>
  ..
</tr>'
}
}
else {
echo //print error msg
}
mysql_close();

I am not too familar with javascript or Ajax. If this code was placed in the header

<a href="" onClick="document.cover.src='backcover.jpg';">
<img src="frontcover.jpg" name="cover">
</a>

, would this not make a change to one one image. How can i do this for each ISBN number..

Thanks, examples will be appreciated
Susan

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.