As part of my website I want to allow members to upload a limited number of images that they can use in building their pages ( within the website ).
Each image will be uploaded and re-sampled to ensure it really is an image and to get it to the correct size.
This is a snippet of what I am using:
Now the problem I have is about updating their file.
imagecopyresampled($N_image, $o_im, 0, 0, 0, 0, $t_wd, $t_ht, $o_wd, $o_ht);
$destination = $_SERVER['DOCUMENT_ROOT']."/im/mem_images/$N_pix_n";
Each time they add photos they will be able to select up to six photos from their computer to upload. This will be in the form.
So I need to be able to update their image table with these six new photos until they reach the end of the file.
I will also have to allow them to replace these images and to view them.
If I want to allow sixty ( 60 ) images then I guess that my sql database
will need a user id field and sixty image name fields
$sql = "CREATE TABLE `client_pics` (
`user_id` varchar(25) NOT NULL default '',
`pict_01` varchar(40) NOT NULL default '',
`pict_02` varchar(40) NOT NULL default '',
`pict_03` varchar(40) NOT NULL default '',
`pict_60` varchar(40) NOT NULL default '',
PRIMARY KEY (user_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1";
$result = mysql_query($sql)
or die("could not CREATE client_pics.". mysql_error());
Now my question is this:
When I am updating this table, what is the best way to find the last
filled up field and continue on from there ?
I will use something like this to add the new files:
Now again - you see my problem - I want to update
$sql = "UPDATE client_pics SET
image1 = '$N_pix1',
image2 = '$N_pix2',
image3 = '$N_pix3',
image4 = '$N_pix4',
image5 = '$N_pix5',
image6 = '$N_pix6'
WHERE user_id = '$ad_ref' ";
or die("could not execute $section UPDATE PICTURES query");
six of the image fields, but I don't know which ones.
The above will only work for the first time they run the script.
Any ideas on how I can write this ?