Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/07/2011, 05:36
Kilin
 
Fecha de Ingreso: junio-2011
Mensajes: 92
Antigüedad: 12 años, 10 meses
Puntos: 3
La DB no se actualiza y el UPDATE no me da errores.

Pues verán, esto haciendo un sistema mediante el cual, ciertas noticias o el logo de mi home, se puedan cambiar mediante un panel de administración, pero me ha surgido un problema.

el código admin.php?editar=1 es el que me permite editar las noticias, y el form se envia a noticias2.php, que SI recibe todas las variables, pero el caso es que, sin tirarme ningun error, me redirige al index.php, que es lo que debe hacer en caso de haberse actualizado todo bien, pero no se actualiza nada!
dejo los códigos:
admin.php
Código:
<?php

$id=$_GET["editar"];
$connect = mysql_connect("server","user","passwd");

mysql_select_db("db",$connect);

$result=mysql_query("select * from home where id_noticia='$id'",$connect);

while($row=mysql_fetch_array($result))
{?>
<style type="text/css">
<!--
.Estilo1 {font-family: Arial, Helvetica, sans-serif}
.Estilo2 {font-size: 24px}
body {
	background-color: #000000;
}
.Estilo4 {font-family: Arial, Helvetica, sans-serif; color: #FFFFFF; }
-->
</style>

<form action="noticias2.php" method="post">
  <table width="800" border="0" align="center" cellpadding="0" cellspacing="10">
  <tr>
    <td width="780" height="488" background="dentro1.png"><div align="center" class="Estilo1 Estilo2">Editar Noticias
    </div>
      <div align="center" class="Estilo1">
        <p> 
          <label>
          <input name="id" type="text" value="'.$row[id_noticia].'" id="id" hidden="hidden" size="3" />
          </label>
        </p>
        <table width="534" border="0" cellspacing="10" cellpadding="0">
        <tr>
          <td width="177">Noticia Uno </td>
          <td width="327"><textarea name="noticia1" cols="50" id="noticia1"><?php echo $row['noticiauno']; ?></textarea></td>
        </tr>
        <tr>
          <td height="29">Noticia Dos </td>
          <td><label>
          <textarea name="noticia2" cols="50" id="noticia2"><?php echo $row['noticiados']; ?></textarea>
          </label></td>
        </tr>
        <tr>
          <td>Noticia Tres </td>
          <td><label>
          <textarea name="noticia3" cols="50" id="noticia3"><?php echo $row['noticiatres']; ?></textarea>
          </label></td>
        </tr>
        <tr>
          <td>Noticia Cuatro </td>
          <td><textarea name="noticia4" cols="50" id="noticia4"><?php echo $row['noticiacuatro']; ?></textarea></td>
        </tr>
        <tr>
          <td>Noticia Cinco </td>
          <td><textarea name="noticia5" cols="50" id="noticia5"><?php echo $row['noticiacinco']; ?></textarea></td>
        </tr>
      </table>
      <p><br />
            <input name="submit" type="submit" value="Actualizar" />
            <br />
        </p>
      </div></td>
  </tr>
</table>
  <p align="center"><span class="Estilo4">ADMINISTRACION</span></p>
  <p>&nbsp;</p></p>
  <p>
    <?php
}
mysql_free_result($result);
mysql_close($connect);

?>
  </p>
</form>  
<p><br>
</p>

noticias2.php
Código:
<?php
$id=$_POST['id'];
$noticiauno=$_POST['noticia1'];
$noticiados=$_POST['noticia2'];
$noticiatres=$_POST['noticia3'];
$noticiacuatro=$_POST['noticia4'];
$noticiacinco=$_POST['noticia5'];
     
$link = mysql_connect("server", "user", "pass");

mysql_select_db("db", $link);
$sql = "UPDATE home SET id_noticia='$id', noticiauno='$noticiauno', noticiados='$noticiados', noticiatres='$noticiatres', noticiacuatro='$noticiacuatro', noticiacinco='$noticiacinco' WHERE id_noticia='$id'";

$result = mysql_query($sql, $link) or die("Error en consulta $sql: ".mysql_error() );

header("location: index.php");
?>
No veo el fallo, alguein puede ayudarme?