exclusão de imagem de pasta e dados do banco, não sei como fazer

1. exclusão de imagem de pasta e dados do banco, não sei como fazer

Denicio Silveira
denicio

(usa Outra)

Enviado em 26/10/2012 - 16:13h

Olá amigos,Boa noite,estou precisando de uma ajuda de vocês,tenho um codigo aqui php,ele exclui na moral no banco de dado os dados referente a foto,mas ñ exclui a foto da pasta foto,não manjo bem php,se pudrem me ajudar agradeceria.
eis os codigos:

>>>>>>>>> LISTAR_PROD.PHP <<<<<<<<<

<?php require_once('../Connections/conexao.php'); ?>
<?php
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_conexao, $conexao);
$query_Recordset1 = "SELECT cod_prod, nome_prod FROM produtos";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $conexao) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>

<html>
<head>
<title>ADMIN</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<div align="center">
<p>
<?php if ($totalRows_Recordset1 == 0) { // Show if recordset empty ?>
<strong>Nenhum produto cadastrado!!</strong>
<?php } // Show if recordset empty ?>
</p>
</div>

<?php if ($totalRows_Recordset1 > 0) { // Show if recordset not empty ?>
<div align="center"><strong> </strong></div>
<table width="506" border="1" align="center">
<tr>
<td colspan="2"> <div align="center"><strong></strong></div>
<div align="center"><strong>Produtos cadastrados</strong></div></td>
</tr>
<?php do { ?>
<tr>
<td width="248"><div align="center">

<a href="excluir_prod.php?cod_prod=<?php echo $row_Recordset1['cod_prod']; ?>" onClick="return confirmSubmit()">Clique
aqui para excluir</a><br>

<a href="alterar_prod.php?cod_prod=<?php echo $row_Recordset1['cod_prod']; ?>">Clique
aqui para alterar</a></div></td>
<td width="242"><div align="center"><?php echo $row_Recordset1['nome_prod']; ?></div></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<?php } // Show if recordset not empty ?>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

>>>>>>>>> EXCLUIR_PROD.PHP <<<<<<<<<<<<

<?php require_once('../Connections/conexao.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

if ((isset($_GET['cod_prod'])) && ($_GET['cod_prod'] != "")) {
$deleteSQL = sprintf("DELETE FROM produtos WHERE cod_prod=%s",

GetSQLValueString($_GET['cod_prod'], "int"));

mysql_select_db($database_conexao, $conexao);
$Result1 = mysql_query($deleteSQL, $conexao) or die(mysql_error());

$deleteGoTo = "excluir_prod2.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
echo "<br>";
echo "<center><b>Operação realizada com sucesso!!!</b></center>";
}
?>


>>>>>>>>> BD <<<<<<<<

CREATE TABLE `produtos` (
`cod_prod` int(11) NOT NULL auto_increment,
`nome_prod` varchar(60) default NULL,
`descricao` text,
`fot_peq` varchar(60) default NULL,
`fot_1` varchar(60) default NULL,
`fot_2` varchar(60) default NULL,
`fot_3` varchar(60) default NULL,
`valor` varchar(60) default NULL,
`destaque` varchar(60) default NULL,
`cod_cat` int(60) default NULL,
PRIMARY KEY (`cod_prod`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;


ficarei muito grato aquem puder me ajudar.


  






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts