Jump to content

Inserting an array of photos into database


bob_the _builder

Recommended Posts

Hi,

 

I have a form layed out like so to upload photos and input the file name into the database.

 

	while($counter <= $nof){
echo '<div class="editpage">
<label>Photo '.($counter+1).' Title</label>
<input type="text" name="photo1alt[]" value="'.$myrow["photo1alt"].'" size="50" /><p />
<label>Change Photo '.($counter+1).'</label>
<input type="file" name="photo_filename[]" size="37" />
</div><p />';
$counter++;
}

 

Im not to sure how to break that up to insert into the database like so ..

 

	$sql = mysql_query("UPDATE mypage SET photo1alt = '$photo1alt', photo1 = '$photo1', photo2alt = '$photo2alt', photo2 = '$photo2', photo3alt = '$photo3alt', photo3 = '$photo3', photo4alt = '$photo4alt', photo4 = '$photo4', photo5alt = '$photo5alt', photo5 = '$photo5' WHERE userid='$userid'");

 

?

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.