Ver Mensaje Individual
  #4 (permalink)  
Antiguo 18/06/2013, 11:25
narlin
 
Fecha de Ingreso: junio-2013
Mensajes: 3
Antigüedad: 10 años, 10 meses
Puntos: 0
Respuesta: Actualizar noticias sin modificar foto

Gracias, muchas gracias lo conseguí asi :
con un if diciendo que si el tamaño del archivo es =0 que solo me actualice texto y titulo, no se si es la mejor forma pero parece que funciona
Código PHP:
    if ($tamano == 0)
        
        {
         
//include_once '../lib/accesoDatos.php'; 
    //$conexion=  getConexion();
      // Guardamos en la BBDD
    //$sql = "INSERT into noticias (titulo,texto,imagen) values ('$_POST[titulo]','$_POST[texto]','$nombre')";

   
$sqlUpadte "UPDATE noticias SET titulo='$titulo', texto='$texto'
           WHERE idNoticia= '$id'"
;
    
   
// $sqlUpadte = "UPDATE noticias SET titulo='$noticia[1]', texto='$noticia[2]',imagen='$nombre',
            //WHERE idNoticia= $noticia[0]";
    
    
 
    
$resultado mysql_query($sqlUpadte);
 
    
// Por si queremos la ID asignada a la imagen
    //$id = mysql_insert_id();
     
header('Location: listadoNoticias.php');   
        }
    else {
    
//include_once '../lib/accesoDatos.php'; 
    //$conexion=  getConexion();
      // Guardamos en la BBDD
    //$sql = "INSERT into noticias (titulo,texto,imagen) values ('$_POST[titulo]','$_POST[texto]','$nombre')";

   
$sqlUpadte "UPDATE noticias SET titulo='$titulo', texto='$texto', imagen='$nombre'
           WHERE idNoticia= '$id'"
;
    
   
// $sqlUpadte = "UPDATE noticias SET titulo='$noticia[1]', texto='$noticia[2]',imagen='$nombre',
            //WHERE idNoticia= $noticia[0]";
    
    
 
    
$resultado mysql_query($sqlUpadte);
 
    
// Por si queremos la ID asignada a la imagen
    //$id = mysql_insert_id();
    
header('Location: listadoNoticias.php');
    }