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.