Ver Mensaje Individual
  #9 (permalink)  
Antiguo 04/07/2011, 16:46
Kilin
 
Fecha de Ingreso: junio-2011
Mensajes: 92
Antigüedad: 12 años, 11 meses
Puntos: 3
Respuesta: Arreglar codigo UPDATE en PHP

Tengo otro problema xD
Ahora, aplicando el codigo a otro formulario, me sale este error
Error en consulta UPDATE home SET id_noticia='', noticiauno='', noticiados='', noticiatres='', noticiacuatro='', noticiacinco='' WHERE id_noticia=:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

el codigo que use fue:

Código:
<?php
$id=$_POST['id'];
$noticiauno=$_POST['noticia1'];
$noticiados=$_POST['noticia2'];
$noticiatres=$_POST['noticia3'];
$noticiacuatro=$_POST['noticia4'];
$noticiacinco=$_POST['noticia5'];


$link = mysql_connect("serv", "user", "pswd");

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

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

header("location: index.php");
?>