[Resolvido] Erro no UPDATE
SQL
tabela: fotos_galeria
estrutura: id | idgaleria | desc | foto
update_foto.php
<?php include"header.php";?>
<div id="container">
<h1>Editar Foto</h1>
<?php
include"includes/config.php";
Conectar();
$id = $_GET["id"];
$sql = mysql_query("select * from fotos_galeria where id='$id'");
$exibe = mysql_fetch_assoc($sql);
?>
<form method="POST" action="update_f.php">
<input name="id" type="hidden" value="<?php echo $exibe["id"];?>"/>
<label><span>Desc:</span>
<input type="text" name="desc" value="<?php echo $exibe["desc"];?>"/>
</label>
<input type="submit" name="enviar" value="Alterar" class="btn-vai"/>
</form>
</div>
<?php include"footer.php";?>
update_f.php
<?php
include"includes/config.php";
Conectar();
$id = $_POST['id'];
$desc = $_POST['desc'];
if(mysql_query("update fotos_galeria set desc='$desc' where id='$id'")){
echo "<script>window.location='add_fotos.php';alert('Foto alterada com sucesso!');</script>";
exit;
}else{
echo "<script>window.location='add_fotos.php';alert('Erro ao alterar foto, clique em ok para tentar novamente');</script>";
exit;
}
?>
ele busca os dados normalmente, só não quer atualizar os novos valores ...
Discussão (5)
Carregando comentários...