I would suggest refreshing image than entire page...
something like:
<img src="generateimage.php" name="randimg">
generateimage.php should pick random image from data base and display it as image using header("content: image/png") functions
and at Next Image button
<a href="Javascript: document.getElementById('randimg').src='generateimage.php';">
This should work If you know wat I mean
Good Luck
TommYNandA