Código:
Y este es el campo que me genera el problema...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; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form_ins_pauta")) { $insertSQL = sprintf("INSERT INTO reg_event (nit, titulo, descripcion, lugar, entrada, tipos, ciudad, f_inicio, f_fin, fecha_ingreso, url, correo, tel_info1, tel_info2, dir, horario, precio, hora_fun, zona_barrio) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['nit'], "int"), GetSQLValueString($_POST['titulo'], "text"), GetSQLValueString($_POST['descripcion'], "text"), GetSQLValueString($_POST['lugar'], "text"), GetSQLValueString($_POST['entrada'], "int"), GetSQLValueString($tipos, "int"), GetSQLValueString($_POST['ciudad'], "text"), GetSQLValueString($tipos, "text"), GetSQLValueString($_POST['ciudad'], "text"), GetSQLValueString($_POST['f_inicio'], "date"), GetSQLValueString($_POST['f_fin'], "date"), GetSQLValueString($_POST['fecha_ingreso'], "date"), GetSQLValueString($_POST['url'], "text"), GetSQLValueString($_POST['correo'], "text"), GetSQLValueString($_POST['tel_info1'], "text"), GetSQLValueString($_POST['tel_info2'], "text"), GetSQLValueString($_POST['dir'], "text"), GetSQLValueString($_POST['horario'], "text"), GetSQLValueString($_POST['precio'], "text"), GetSQLValueString($hora_fun, "text"), GetSQLValueString($_POST['zona_barrio'], "text")); mysql_select_db($database_conectar, $conectar); $Result1 = mysql_query($insertSQL, $conectar) or die(mysql_error()); $insertGoTo = "reg_event_exitoso.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); }
Código HTML:
<input name="zona_barrio" type="text" size="50" maxlength="50" />
error
Código:
Muchas gracias por su ayuda... Column 'zona_barrio' cannot be null