You have your first query with an "ORDER BY number DESC". If I'm looking at it correctly, you're using the first query to just get the total number of photos and thats it, right? If so, I'd drop the ORDER BY - you'll gain a little bit of performance since you're not asking your database to do some sorting that you won't take advantage of (maybe put the ORDER BY in your 2nd query).
As for the 1 table trick, yes, I'd recommend 1 table with 4 columns (or how ever many you decide).
There's a couple different ways to solve this problem.
You could put in a for() loop in the while loop. In the while loop and before the for() loop you create your row and after your for() loop you end your row. In the guts of the for() you put in the HTML/PHP to generate 1 photo. I don't highly recommend this approach because you have to manage what happens when you run out of records from your query.
You can do the above trick with a counter. If counter is 0, then dump out the start of the row. When its 4, dump out the end of the row and reset the counter.
If you're uber-smooth, you might try using the modulus operator '%'. This would eliminate the need to reset the counter.