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

Recommended Answers

All 3 Replies

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>

you can use ajax for that

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.