Ver Mensaje Individual
  #5 (permalink)  
Antiguo 02/01/2006, 12:55
arameo2010
 
Fecha de Ingreso: diciembre-2004
Mensajes: 156
Antigüedad: 19 años, 4 meses
Puntos: 0
hola gracias pro contestar estas son las lineas, o una partes!!! gracias

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 cursos (cedula, institucion, localidad, curso, horas, fecha) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['cedula'], "text"),
GetSQLValueString($_POST['institucion'], "text"),
GetSQLValueString($_POST['localidad'], "text"),
GetSQLValueString($_POST['curso'], "text"),
GetSQLValueString($_POST['horas'], "int"),
GetSQLValueString($_POST['fecha'], "date"));

mysql_select_db($database_localhost, $localhost);
$Result1 = mysql_query($insertSQL, $localhost) or die(mysql_error());

$insertGoTo = "cursos.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}