Problemas al cargar datos en mi tabla
Publicado por Edwin (2 intervenciones) el 17/10/2017 20:45:02
Buenas tengo un problema con mi código, no cargar los datos en mi mysql, es un códifo heredado y la verdad es que me estoy iniciando en mysql, si alguien me podría ayudar por favor, les paso el código.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
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"] == "form2")) {
if(empty($error)){
//creamos nuevo nombre para que tenga nombre unico
$nombre_nuevo2 = $_POST['ci'];
///////////////////////////////////////////
// se agrega "archivo_archivos, extension_archivos y la fecha" a la consulta y dos extra %s separados por comas
$insertSQL = sprintf("INSERT INTO postulantes_2017 (prospecto, nombre, apellido_paterno, apellido_materno, ci, ci_departamento, sexo, departamento_nacimiento, lugar_compra, deposito_bancario)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['prospecto'], "text"),
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['apellido_paterno'], "text"),
GetSQLValueString($_POST['apellido_materno'], "text"),
GetSQLValueString($_POST['ci'], "text"),
GetSQLValueString($_POST['ci_departamento'], "text"),
GetSQLValueString($_POST['sexo'], "text"),
GetSQLValueString($_POST['departamento_nacimiento'], "text"),
GetSQLValueString($_POST['lugar_compra'], "text"),
GetSQLValueString($_POST['deposito_bancario'], "text")
);
mysql_select_db($database_connect1, $connect1);
$Result1 = mysql_query($insertSQL, $connect1) or die(mysql_error());
$insertGoTo = "registro_postulantes_bueno.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
}
?>
Valora esta pregunta


0