Ver Mensaje Individual
  #4 (permalink)  
Antiguo 23/07/2007, 13:24
xmedia
 
Fecha de Ingreso: mayo-2003
Mensajes: 174
Antigüedad: 21 años
Puntos: 0
Re: Problemas con función unlink (PHP)

No es un directorio, quiero borrar un registro de una BD, estos registros tienen entre 1 y 3 fotos, loq ue gusrdo en la BD es el nombre del archivo (foto_x.jpg) y con el siguiente código elimino el registro y las fotos asociadas:


Código PHP:
<?
include("../../conex.php");
$link=Conectarse();

$ID=$_GET['ID'];

$result=mysql_query("delete from propiedades where ID=$ID",$link);

$path="../../fotos";
if(
$nomfoto1 != "no_foto1.jpg")
   
$file1=$path."/".$nomfoto1;
   
unlink($file1);
if(
$nomfoto2 != "no_foto2.jpg")
   
$file2=$path."/".$nomfoto2;
   
unlink($file2);
if(
$nomfoto3 != "no_foto3.jpg")
   
$file3=$path."/".$nomfoto3;
   
unlink($file3);
   
header("Location:borrar_bd.php");
?>
Esop... gracias

Última edición por xmedia; 23/07/2007 a las 13:29