Page 1 of 1

Multiple image names stored in SQL/PHP for unlimited uploads

Posted: Thu Apr 02, 2009 8:47 am
by simonmlewis
Hi

At the moment I have a gallery that stores just two images maximum. Each image upload PHP files has it's own PHP file (as it's relational to the photo and photo2 field names in mySQL.

The problem this creates is that it limits the amount of images the client can have, and when they are trying to sell something that needs around 8-10 images, it's restrictive.

So I need to be able to use one form to upload images over and over again, so they either store in lots of fields, or as an array in one 'photo' field.

I have a 'lightbox' techinique on the main site, so the user can click on one image and they would all appear as a gallery.

How can I (a) write code that will send the image file (which does so thru an upload file script) and the file name to MySQL field, and (b) display all images on a page?

At the moment they render through $row->photo, or $row->photo2. So the result is

Code: Select all

<img src="images/$row->photo" />
Rendered as
<img src="images/livingroom.jpg" />
Any help would be appreciated.

Regards
Simon