0
My problem is that the file img_editar.php
not sending the images to the database (it is to add several images at the same time), the file add image works very well, I click the edit option and when I change for example the name of the image I am obliged to change the images, only that changing the images these are not sent to the BD, I even have the function to keep the images if($_FILES['img']['size'] > 0)
but it’s not working.
<?php
include "bd.php";
include "_config.php";
include "admin.php";
$target = "../upload/";
$target = $target . basename( $_FILES['img']['name']);
$pic=($_FILES['img']['name']);
$data=date("ymd");
$query="update portfolio_imagens set nome='".$_POST['nome']."', descricao='".$_POST['descricao']."', cliente='".$_POST['cliente']."', publicacao='".$data."' where id=".$_GET['id'];
$result=mysql_query($query);
$picas=0;
echo $query;
if($_FILES['img']['size'] > 0){
//echo "1";
$query2="update portfolio_imagens set imagem='".$pic."' where id=".$_GET['id'];
$result2=mysql_query($query2);
$picas=1;
}
if(move_uploaded_file($_FILES['img']['tmp_name'], $target) || $picas=1) //
{
echo "<div class=\"alert alert-success fade in\">
<i class=\"fa fa-check-circle fa-fw fa-lg\"></i>
<strong>Notícia criada com sucesso!</strong>
</div>";
echo '<script>window.location.href = "adicionar.php?msg=1";</script>';
}else{
echo "<div class=\"alert alert-danger fade in\">
<i class=\"fa fa-ban fa-fw fa-lg\"></i>
<strong>Erro!</strong>
</div>";
echo '<script>window.location.href = "adicionar.php?msg=2";</script>';
}
?>
If you please put this in code mode I don’t know how to do it here
– cloud
How to debug code in PHP?
– brasofilo