Código HTML:
<?php require_once('../Connections/lastrega.php'); ?><?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $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; } } if ((isset($_GET['id_apert'])) && ($_GET['id_apert'] != "") && (isset($_GET['recordID']))) { $deleteSQL = sprintf("DELETE FROM aperitivos WHERE id_apert=%s", GetSQLValueString($_GET['id_apert'], "int")); mysql_select_db($database_lastrega, $lastrega); $Result1 = mysql_query($deleteSQL, $lastrega) or die(mysql_error()); $deleteGoTo = "eliminar_apert.php"; if (isset($_SERVER['QUERY_STRING'])) { $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?"; $deleteGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $deleteGoTo)); } $maxRows_DetailRS1 = 10; $pageNum_DetailRS1 = 0; if (isset($_GET['pageNum_DetailRS1'])) { $pageNum_DetailRS1 = $_GET['pageNum_DetailRS1']; } $startRow_DetailRS1 = $pageNum_DetailRS1 * $maxRows_DetailRS1; $colname_DetailRS1 = "-1"; if (isset($_GET['recordID'])) { $colname_DetailRS1 = $_GET['recordID']; } mysql_select_db($database_lastrega, $lastrega); $query_DetailRS1 = sprintf("SELECT * FROM aperitivos WHERE id_apert = %s", GetSQLValueString($colname_DetailRS1, "int")); $query_limit_DetailRS1 = sprintf("%s LIMIT %d, %d", $query_DetailRS1, $startRow_DetailRS1, $maxRows_DetailRS1); $DetailRS1 = mysql_query($query_limit_DetailRS1, $lastrega) or die(mysql_error()); $row_DetailRS1 = mysql_fetch_assoc($DetailRS1); if (isset($_GET['totalRows_DetailRS1'])) { $totalRows_DetailRS1 = $_GET['totalRows_DetailRS1']; } else { $all_DetailRS1 = mysql_query($query_DetailRS1); $totalRows_DetailRS1 = mysql_num_rows($all_DetailRS1); } $totalPages_DetailRS1 = ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1; ?> <form id="form1" name="form1" method="post" action="eliminar_apert.php"> <input name="id_apert" type="hidden" id="id_apert" value="<?php echo $row_DetailRS1['id_apert']; ?>" /> <table border="1" align="center"> <tr> <td width="61"><div align="right">ID Aperitivo:</div></td> <td width="112"><?php echo $row_DetailRS1['id_apert']; ?> </td> </tr> <tr> <td><div align="right">Nombre:</div></td> <td><?php echo $row_DetailRS1['nom_apert']; ?> </td> </tr> <tr> <td><div align="right">Precio:</div></td> <td><?php echo $row_DetailRS1['precio_apert']; ?> </td> </tr> <tr> </tr> </table> <label> <div align="center"> <input type="submit" name="button" id="button" value="Eliminar" /> </div> </label> </form> <?php mysql_free_result($DetailRS1); ?>