Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/09/2009, 16:36
cher1_7
(Desactivado)
 
Fecha de Ingreso: junio-2008
Mensajes: 287
Antigüedad: 15 años, 10 meses
Puntos: 9
ayuda con php por fas me sale error 'WHERE ID = '''

lo que pasa es que esoy usando la variable update para modificar datos de una bd pero al modificar los datos me manda un error

me tira este error miren 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 'WHERE ID = ''' at line 11

Código PHP:
<?php

$link 
mysql_connect('localhost','xxx','xxx');
if(!
$link) {
die(
"Error al intentar conectar: ".mysql_error());
}

$db_link mysql_select_db('xxx'$link);
if(!
$db_link) {
die(
"Error al intentar seleccionar la base de datos"mysql_error());
}

if(isset(
$_GET['id'])){
$id $_GET['id'];

$sql mysql_query("SELECT * FROM registro_cuenta
WHERE ID = $id"
$link)
or die(
mysql_error());
$row mysql_fetch_array($sql);

$mensaje "Modificar o Actualizar datos de <b>$row[nombre]</b>";
}

if(isset(
$_POST['actualizar']) && $_POST['actualizar'] == 'Actualizar'){

if(!empty(
$_POST['nombre']) && !empty($_POST['direccion']) && !empty($_POST['email'])){

$ID $_POST['ID'];
$usuario $_POST['usuario'];
$puntos $_POST['puntos'];
$nip $_POST['nip'];
$nombre $_POST['nombre'];
$direccion $_POST['direccion'];
$telefono $_POST['telefono'];
$email $_POST['email'];
$credencial $_POST['credencial'];
// la consulta UPDATE
$sqlUpdate mysql_query("UPDATE registro_cuenta
SET ID = '$ID',
    usuario = '$usuario',
    puntos = '$puntos',
                nip = '$nip',
    nombre = '$nombre',
    direccion = '$direccion',
    telefono = '$telefono',
    email = '$email',
    credencial = '$credencial',    
WHERE ID = '$ID'"
$link)
or die(
mysql_error());
header("Location: ../actualizacion_correcta.php");
}else{
echo 
"debe llenar todos los campos";
}
}else{
echo 
"";
?>
de antemano gracias...