Enviado em 27/10/2012 - 20: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 puderem me ajudar agradeceria.
>>>>>>>>> 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 ;
Atualizando o Passado: Linux no Lenovo G460 em 2025
aaPanel - Um Painel de Hospedagem Gratuito e Poderoso
O macete do Warsaw no Linux Mint e cia
Um modo leve de ouvir/ver áudio/vídeo da internet em máquinas pererecas
Resolver algumas mensagens de erro do SSH
Instalar módulo de segurança do Banco do Brasil Warsaw do tipo .run
Sem espaço na partição home (2)
O que você está ouvindo agora? [2] (190)
Procrastinação e autossabotagem são problemas muito comuns na sociedad... (5)