I've been stuck in a situation.
I am trying to retrieve image from database using ajax. I am using php as a server side scripting language..

I need to run the js funtion on every image i fetch from the database which happens to be a while loop...But that doesnt seem to be working....

Any tips and tricks....or any solution....Please...!!!!

Recommended Answers

All 2 Replies

It's easy man.

Assume you are retrieving images IDs from database, then:

<?php
while($row = mysql_fetch_array($result){
     $image_id = $row['image_id'];
     echo "<script>LoadImage($image_id)</script>";
}
?>

in the javascript side, you choose the source you need to retrieve the image in, like retrieve it in specific DIV.

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.