I fixed one error... In galleries who's names contained a (') character, the database statement would get messed up.
for those of you that care: select * from photos where album='$album'
where $album is the variable that is passed in from the previous page... If that contained a ' ... there would be one too many in the statemnt statement... it would become: