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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.