Código:
Estos son los archivos que uso:Warning: unlink() [function.unlink]: No such file or directory in /homepages/21/d228437082/htdocs/php/borra.php on line 7 Warning: unlink() [function.unlink]: No such file or directory in /homepages/21/d228437082/htdocs/php/borra.php on line 8 Warning: Cannot modify header information - headers already sent by (output started at /homepages/21/d228437082/htdocs/php/borra.php:7) in /homepages/21/d228437082/htdocs/php/borra.php on line 10
lista_borrar.php
Código PHP:
<html>
<head>
<title>Borrar</title>
</head>
<body>
<H1>Borrar</H1>
<?php
include("conex.phtml");
$link=Conectarse();
$result=mysql_query("select * from productos ORDER BY producto, fabricante, modelo ASC",$link);
?>
<table border=1 cellspacing=1 cellpadding=1>
<tr><td><b>Producto</b></td><td><b>Fabricante</b></td><td><b>Modelo</b></td><td><b>Potencia</b></td><td><b>Caudal</b></td><td><b>Presion</b></td><td><b>PDF</b></td><td><b>IMG</b></td><td><b>Borrar</b></td></tr>
<?php
while($row = mysql_fetch_array($result)) {
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td><a href=\"%s\" title=\"Ver PDF\" target=\"_blank\"><img src=\"images/pdf.gif\" alt=\"Ver PDF\" border=\"0\" /></a></td><td><a href=\"%s\" rel=\"gb_image[]\" title=\"%s\"><img src=\"images/imagen.gif\" alt=\"Ver PDF\" border=\"0\" /></a></td><td><a href=\"borra.php?id=%d&pdf=%s&img=%s\">Borrar</a></td></tr>", $row["producto"],$row["fabricante"],$row["modelo"],$row["potencia"],$row["caudal"],$row["presion"],$row["pdf"],$row["img"],$row["modelo"],$row["id"],$row["pdf"],$row["img"]);
}
mysql_free_result($result);
mysql_close($link);
?>
</table>
</body>
</html>
Código PHP:
<?php
include("conex.phtml");
$link=Conectarse();
$id=$_REQUEST['id'];
$pdf=$_REQUEST['pdf'];
$img=$_REQUEST['img'];
unlink("$pdf");
unlink("$img");
mysql_query("delete from productos where id = $id",$link);
header("Location: lista_borrar.php");
?>
Gracias.