Firstly, do you need to build this from scratch or would something like osCommerce: http://www.oscommerce.com/ suit you?
In any case, you need to create a separate table for orders presuming you already have a table for the photos that can be ordered.
The orders will have it's own auto-increment primary key just like the photos table. You'll be able to tie photos with orders by creating a second column in the orders table (orders.photoid). Each time an order is made the photo.id should be inserted into orders.photoid.
This way, you can reference the entries of the two tables with :
select * from orders, photo
where orders.photoid = photo.id