First of all, you're storing the output of [man]mysql_fetch_assoc/man into $photo, but you later try to access $sqlphoto as if it held the data. Still, even after correcting this, mysql_fetch_assoc() only retrieves one row at a time, so you basically need to do one of two things:
Loop through the result set (commonly done with a [man]while/man statement) and output the HTML as you go.
Use a while() loop, but instead of outputting anything, build an array. Example:
$photos = array();
while($data = mysql_fetch_assoc($photo))
$photos[] = $data['photo_name'];
Also, note that if you're only using the photo_name column, you should simply SELECT that column. I always avoid using SELECT *, since it's generally wasting resources plus it isn't scalable.
EDIT: I was typing this post as you posted again, so a few points I made can be ignored! :p