3
Good night.
I would like to count on your help in solving a problem that has been grinding my molecule for a few days and I have not yet been able to find a solution.
I have the following code to upload to the 4-photo server:
if(isset($_POST['submit']))
{
$selectmaxpro=mysql_fetch_array(mysql_query("select max(`imp_id`) as `impid` from `imp`"));
$maxidpro=$selectmaxpro['impid']+1;
$path = "imo/uploads/";
$count = 0;
foreach ($_FILES['files']['name'] as $f => $name) {
mysql_query("insert into `images_imp` values('','$name','$maxidpro')");
if(move_uploaded_file($_FILES["files"]["tmp_name"][$f], $path.$name)) {
$count++;
}
}
So far so good... my problem is that in the database the elements are all followed assuming the same id. How the image shows:
What query radius do I have to do for the array values to be saved in different columns type:
If not possible, how can I access or select each of the images separately for presentation on the page? The code I have only allows me to display the first of the images with the same id...
<div id="imagem1">
<?php
$selectphoto=mysql_fetch_array(mysql_query("select * from `images_imp` where `imp_id`='$id' "));
?>
<img id="targetLayer" src="imo/uploads/<?php echo $selectphoto['imag']; ?>" alt="Image">
</div>
Thanks in advance for your help.
Hug Nuno S.
Does not use functions
mysql_*
, you can do this based on this answer: http://answall.com/questions/101087/como-passo-par%C3%A2metros-dinamicos-numa-preparedstatment, or you can use thePDO
.– Edilson