<?php
$con=mysql_connect("localhost","root","");
$bd="victoria2006";
?>
<?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 persona (Nombre, Apellido1, Apellido2, Cedula, idsexo, Edad, Direccion, MenoresC, idTipoPersona, IdCondicionEspecial, IMensual, TMienbros, idVivienda) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Nombre'], "text"),
GetSQLValueString($_POST['Apellido1'], "text"),
GetSQLValueString($_POST['Apellido2'], "text"),
GetSQLValueString($_POST['Cedula'], "text"),
GetSQLValueString($_POST['Descripcion'], "text"),
GetSQLValueString($_POST['Edad'], "text"),
GetSQLValueString($_POST['Direccion'], "text"),
GetSQLValueString($_POST['MenoresC'], "text"),
GetSQLValueString($_POST['Descripcion'], "text"),
GetSQLValueString($_POST['Descripcion'], "text"),
GetSQLValueString($_POST['IMensual'], "text"),
GetSQLValueString($_POST['TMienbros'], "text"),
GetSQLValueString($_POST['Descripcion'], "text"));
mysql_select_db($bd, $con);
$Result1 = mysql_query($insertSQL, $bd) or die(mysql_error());
$insertSQL="El usuario se registro satisfactoriamente";
}
mysql_select_db($bd, $con);
$query_rec_sexo = "SELECT * FROM sexo";
$rec_sexo = mysql_query($query_rec_sexo, $con) or die(mysql_error());
$row_rec_sexo = mysql_fetch_assoc($rec_sexo);
$totalRows_rec_sexo = mysql_num_rows($rec_sexo);
mysql_select_db($bd, $con);
$query_rec_tip = "SELECT * FROM tipopersona";
$rec_tip = mysql_query($query_rec_tip, $con) or die(mysql_error());
$row_rec_tip = mysql_fetch_assoc($rec_tip);
$totalRows_rec_tip = mysql_num_rows($rec_tip);
mysql_select_db($bd, $con);
$query_rec_coe = "SELECT * FROM condicionespecial";
$rec_coe = mysql_query($query_rec_coe, $con) or die(mysql_error());
$row_rec_coe = mysql_fetch_assoc($rec_coe);
$totalRows_rec_coe = mysql_num_rows($rec_coe);
mysql_select_db($bd, $con);
$query_rec_viv = "SELECT * FROM vivienda";
$rec_viv = mysql_query($query_rec_viv, $con) or die(mysql_error());
$row_rec_viv = mysql_fetch_assoc($rec_viv);
$totalRows_rec_viv = mysql_num_rows($rec_viv);
?>