Thanks Chuck, that nearly solved my problem

All I have to know is how to change the line
$result = mysql_query("SELECT id,cat,bigimage FROM pp_photos order by rand() LIMIT 3" ) or die(mysql_error());
to output the newest 3 images instead of random ones. However, it works so far.