Código 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;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO indicador (cod_indicador, porcentaje, descripcion, cod_logro) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['cod_indicador'], "int"),
GetSQLValueString($_POST['porcentaje'], "text"),
GetSQLValueString($_POST['descripcion'], "text"),
GetSQLValueString($_POST['cod_logro'], "int"));
mysql_select_db($database_notas, $notas);
if ($Result1 = mysql_query($insertSQL, $notas)){;
echo "Registro Insertado Satisfactoriamente <br>";
}else{
echo "El Indicador Ya Se Encuentra Ingresado En El Sistema <br>";
}
}
$maxRows_registro9 = 10;
$pageNum_registro9 = 0;
if (isset($_GET['pageNum_registro9'])) {
$pageNum_registro9 = $_GET['pageNum_registro9'];
}
$startRow_registro9 = $pageNum_registro9 * $maxRows_registro9;
mysql_select_db($database_notas, $notas);
$query_registro9 = "SELECT cod_logro, porcentaje, descripcion FROM logro";
$query_limit_registro9 = sprintf("%s LIMIT %d, %d", $query_registro9, $startRow_registro9, $maxRows_registro9);
$registro9 = mysql_query($query_limit_registro9, $notas) or die(mysql_error());
$row_registro9 = mysql_fetch_assoc($registro9);
if (isset($_GET['totalRows_registro9'])) {
$totalRows_registro9 = $_GET['totalRows_registro9'];
} else {
$all_registro9 = mysql_query($query_registro9);
$totalRows_registro9 = mysql_num_rows($all_registro9);
}
$totalPages_registro9 = ceil($totalRows_registro9/$maxRows_registro9)-1;
mysql_select_db($database_notas, $notas);
$query_Recordset2 = "SELECT * FROM indicador";
$Recordset2 = mysql_query($query_Recordset2, $notas) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>