criei um portal de noticias, so que estou com problemas em relação ao deletar uma categoria, pois ela não pode conter noticias nela. então criei uma verificação se o valor de SELECT COUNT(*) AS total for 0 ele vai deletar a categoria caso contrario ele vai mandar uma noticia sendo que imposivel deleta-la.
olhe a pagina esta dando erro.
Parse error: parse error, unexpected $end in D:\EasyPHP 2.0b1\www\admin\categoria_exclui.php on line 79
Pergunta
Del Palmis
Bom galera uma ajuda aqui...
criei um portal de noticias, so que estou com problemas em relação ao deletar uma categoria, pois ela não pode conter noticias nela. então criei uma verificação se o valor de SELECT COUNT(*) AS total for 0 ele vai deletar a categoria caso contrario ele vai mandar uma noticia sendo que imposivel deleta-la.
olhe a pagina esta dando erro.
Parse error: parse error, unexpected $end in D:\EasyPHP 2.0b1\www\admin\categoria_exclui.php on line 79
<?php require_once('../Connections/config.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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; } } $colname_verifica = "-1"; if (isset($_GET['categoriaID'])) { $colname_verifica = $_GET['categoriaID']; } mysql_select_db($database_config, $config); $query_verifica = sprintf("SELECT COUNT(*) AS total FROM cadastro_noticias WHERE categoriaID = %s", GetSQLValueString($colname_verifica, "int")); $verifica = mysql_query($query_verifica, $config) or die(mysql_error()); $row_verifica = mysql_fetch_assoc($verifica); $totalRows_verifica = mysql_num_rows($verifica); if(0 == $row_verifica['total']): if ((isset($_POST['categoriaID'])) && ($_POST['categoriaID'] != "") && (isset($_GET['categoriaID']))) { $deleteSQL = sprintf("DELETE FROM categoria WHERE categoriaID=%s", GetSQLValueString($_POST['categoriaID'], "int")); mysql_select_db($database_config, $config); $Result1 = mysql_query($deleteSQL, $config) or die(mysql_error()); $deleteGoTo = "categorias.php"; if (isset($_SERVER['QUERY_STRING'])) { $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?"; $deleteGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $deleteGoTo)); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>AdminCP - Portal X Games</title> </head> <body><div align="center"><form method="post" action=""> <p>Você realmente deseja excluir esta categoria?</p> <p> <input type="submit" value="Sim" /> <input type="hidden" name="intCatID" value="<?php echo $_GET['categoriaID']; ?>" /> </p> </form></div> </body> </html> <?php mysql_free_result($verifica); ?>Editado por Del PalmisLink para o comentário
Compartilhar em outros sites
4 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.