Store div images in mysql database

hi,
I developed one web application and I have created div in JavaScript and on that div I have created more than one images and when I click on save button i want to save all images on to the database and when I retrieve that image from database as it is again displayed on that div.
So how to get all images from that div and store into the database and retrieve again.......

do you give those images an id in the html? if so, you can use this id.
for instance, if your images are stored with id's img001, img002, img003, ..., imgxxx
you could write a script that iterates over them, and, as long as he finds the next image, write it to the database.