Bom Dia Galera !!!! bom esta acontecendo o seguinte eu monte um script que ele visualiza os dados no bd mysql e tem um link em cada registro de alterar, qd eu clico nele ele vai para uma pagina de formulario e no form os campos já veem prenchido com a infos dakele id, ai eu altero o campo que eu quero e qd eu mando enviar ele me falar que foi modificado numa boa, só que no banco não foi modificado nada.... eu vou passar os codigos abaixos para vocês verem. UPDATENOTICIAS.PHP - ESSA PAGINA VISUALIZA AS INFO DO BANCO
<?
echo"
<table width=\"330\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
";
include "conecta.php";
$result = mysql_query ("SELECT * FROM varela_noticias ORDER BY id_noticias DESC LIMIT 3");
while ($row = mysql_fetch_array($result)){
$id_noticias = $row["id_noticias"];
$data = $row["data"];
$resumo = $row["resumo"];
echo "
<tr>
<td><font color=\"#0033CC\" size=\"2\" face=\"Tahoma, Arial\"><strong>$data</strong></font></td>
</tr>
<tr>
<td><font size=\"2\" face=\"Tahoma, Arial\">$resumo</font></td>
</tr>
<tr>
<td><div align=\"right\"><strong><font color=\"#0033CC\" size=\"2\" face=\"Tahoma, Arial\"><a href=formupdate.php?id_noticias=$id_noticias>alterar</a></font></strong></div></td>
</tr>
<tr>
<td> </td>
</tr>
";
}
if ($total != "0") {
if (($begin > 0) and ($begin <= 8)) {
$anteriores = '<a href="cad.php?begin=0"><b>Anteriores</b></a>';
} elseif (($begin > 0) and ($begin > 8)) {
$anteriores = '<a href="cad.php?begin=' . ($begin-8) . '"><b>Anteriores</b></a>';
} else {
$anteriores = '<b>Anteriores</b>';
}
if (($begin < $total) and (($begin+8) >= $total)) {
$proximas = '<b>Próximas</b>';
} else {
$proximas = '<a href="cad.php?begin=' . ($begin+8) . '"><b>Próximas</b></a>';
} echo " ";
}
echo "</table>";
?>
FORMUPDATE.PHP - ESSA PAGINA QUE É O FORMULARIO DE ALTERAÇÃO DOS CAMPOS EU não CONSIGO VISUALIZAR AS INFO DO BANCO NOS CAMPOS DO FORM , MAIS NA URL ELE APARECE QUE ID EU TO ALTERANDO.
<?
include "conecta.php";
$data = $_POST['data'];
$noticias = $_POST['noticias'];
$resumo = $_POST['resumo'];
$foto1 = $_POST['foto1'];
$foto2 = $_POST['foto2'];
$foto3 = $_POST['foto3'];
$foto4 = $_POST['foto4'];
$foto5 = $_POST['foto5'];
$foto6 = $_POST['foto6'];
$result = mysql_query ("SELECT * FROM varela_noticias WHERE id_noticias = 'id_noticias'");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
.style2 {font-family: Tahoma, Arial; font-size: 9px; }
.style4 {font-family: Tahoma, Arial; font-size: 9px; color: #990000; }
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
</head>
<body>
<form name="form1" method="post" action="updatenoticias.php">
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="78"><div align="right" class="style2">Data : </div></td>
<td width="322"><input name="data" type="text" id="data" value="<? print $result[data]; ?>" size="10" maxlength="10">
<span class="style4">* dd.mm.aaaa</span></td>
</tr>
<tr>
<td><div align="right" class="style2">Resumo : </div></td>
<td><textarea name="resumo" cols="50" rows="5" id="resumo" value="<? print $result[resumo]; ?>"></textarea></td>
</tr>
<tr>
<td><div align="right" class="style2">Titulo : </div></td>
<td><textarea name="noticias" cols="50" rows="15" id="noticias" value="<? print $result[noticias]; ?>"></textarea></td>
</tr>
<tr>
<td><div align="right" class="style2">Foto 1 : </div></td>
<td><input name="foto1" type="text" id="foto1" value="<? print $result[foto1]; ?>" size="54"></td>
</tr>
<tr>
<td><div align="right" class="style2">Foto 2 :</div></td>
<td><input name="foto2" type="text" id="foto2" value="<? print $result[foto2]; ?>" size="54"></td>
</tr>
<tr>
<td><div align="right" class="style2">Foto 3 :</div></td>
<td><input name="foto3" type="text" id="foto3" value="<? print $result[foto3]; ?>" size="54"></td>
</tr>
<tr>
<td><div align="right" class="style2">Foto 4 :</div></td>
<td><input name="foto4" type="text" id="foto4" value="<? print $result[foto4]; ?>" size="54"></td>
</tr>
<tr>
<td><div align="right" class="style2">Foto 5 :</div></td>
<td><input name="foto5" type="text" id="foto5" value="<? print $result[foto5]; ?>" size="54"></td>
</tr>
<tr>
<td><div align="right" class="style2">Foto 6 :</div></td>
<td><input name="foto6" type="text" id="foto6" value="<? print $result[foto6]; ?>" size="54"></td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<p> </p>
<p>
<input type="submit" name="Submit" value="Incluir Noticias">
</p>
<p> </p>
</div></td>
</tr>
</table>
</form>
</body>
</html>
UPDATENOTICIAS.PHP - ESSA É A PAGINA QUE ENVIA A ALTERAÇÃO PRO BANCO
<?
//conexão com o db
include ("conecta.php");
//variaveis enviadas pelo método post
$data = $_POST['data'];
$noticias = $_POST['noticias'];
$resumo = $_POST['resumo'];
$foto1 = $_POST['foto1'];
$foto2 = $_POST['foto2'];
$foto3 = $_POST['foto3'];
$foto4 = $_POST['foto4'];
$foto5 = $_POST['foto5'];
$foto6 = $_POST['foto6'];
//insere os valores no db
$query = "UPDATE varela_noticias SET data='$data', noticias='$noticias', resumo='$resumo', foto1='$foto1', foto2='$foto2', foto3='$foto3', foto4='$foto4', foto5='$foto5', foto6='$foto6' WHERE id_noticias='$id_noticias' ";
$result = mysql_query($query) or die("Query failed");
if($result)
echo "alterado com sucesso
";
else
echo "não incluido";
?>
Recapitulando: eu não consigo fazer o update das infos alterada, e não consigo fazer o campo do form mostra as info de um determinada id que escolhi pra alterar. POR FAVOR ME AJUDEM !!!! Fico muito grato