Ver Mensaje Individual
  #13 (permalink)  
Antiguo 18/03/2008, 06:49
Avatar de T4ke0veR
T4ke0veR
 
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Re: Enviando campos vacios de form a DB

ok lo hice y me dice esto

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' , , , 'Afganistán', , , , , , , , , , 'cedula', , 'menuitem1', 'Masculino', 'S' at line 1

Código PHP:
<?php require_once('../Connections/pintor.php'); ?>
<?php
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 "'" "";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "";
      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 rrhh (id, nombres, apellidos, email, pais, estado, ciudad, urbanizacion, calle, casa, piso, telcasa, telcelular, nacionalidad, cedpas, numerodoc, fechanac, sexo, estadocivil, objetivos, cargo, puesto, tipotrabajo, sueldo, cambiociudad, desde, hasta, empresa, dir_empresa, cargo_empresa, jefe, cargo_jefe, terminacion, sueldo_final, desde2, hasta2, empresa2, dir_empresa2, cargo_empresa2, jefe2, cargo_jefe2, terminacion2, sueldo_final2, desde3, hasta3, empresa3, dir_empresa3, cargo_empresa3, jefe3, cargo_jefe3, terminacion3, sueldo_final3, instituto, dir_instituto, anos_cur, inicio_inst, final_inst, titulo, instituto2, dir_instituto2, anos_cur2, inicio_inst2, final_inst2, titulo2, instituto3, dir_instituto3, anos_cur3, inicio_cur3, final_cur3, titulo3, instituto4, dir_instituto4, anos_cur4, inicio_inst4, final_inst4, titulo4, instituto5, dir_instituto5, anos_cur5, inicio_inst5, final_inst5, titulo5, nomape, direccion_ref, tel_ref, tiempo_ref, nomape2, direccion_ref2, tel_ref2, tiempo_ref2) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['id'], "int"),
                       
GetSQLValueString($_POST['nombres'], "text"),
                       
GetSQLValueString($_POST['apellidos'], "text"),
                       
GetSQLValueString($_POST['email'], "text"),
                       
GetSQLValueString($_POST['pais'], "text"),
                       
GetSQLValueString($_POST['estado'], "text"),
                       
GetSQLValueString($_POST['ciudad'], "text"),
                       
GetSQLValueString($_POST['urbanizacion'], "text"),
                       
GetSQLValueString($_POST['calle'], "text"),
                       
GetSQLValueString($_POST['casa'], "text"),
                       
GetSQLValueString($_POST['piso'], "text"),
                       
GetSQLValueString($_POST['telcasa'], "text"),
                       
GetSQLValueString($_POST['telcelular'], "text"),
                       
GetSQLValueString($_POST['nacionalidad'], "text"),
                       
GetSQLValueString($_POST['cedpas'], "text"),
                       
GetSQLValueString($_POST['numerodoc'], "text"),
                       
GetSQLValueString($_POST['fechanac'], "date"),
                       
GetSQLValueString($_POST['sexo'], "text"),
                       
GetSQLValueString($_POST['estadocivil'], "text"),
                       
GetSQLValueString($_POST['objetivos'], "text"),
                       
GetSQLValueString($_POST['cargo'], "text"),
                       
GetSQLValueString($_POST['puesto'], "text"),
                       
GetSQLValueString($_POST['tipotrabajo'], "text"),
                       
GetSQLValueString($_POST['sueldo'], "text"),
                       
GetSQLValueString($_POST['cambiociudad'], "text"),
                       
GetSQLValueString($_POST['desde'], "text"),
                       
GetSQLValueString($_POST['hasta'], "text"),
                       
GetSQLValueString($_POST['empresa'], "text"),
                       
GetSQLValueString($_POST['dir_empresa'], "text"),
                       
GetSQLValueString($_POST['cargo_empresa'], "text"),
                       
GetSQLValueString($_POST['jefe'], "text"),
                       
GetSQLValueString($_POST['cargo_jefe'], "text"),
                       
GetSQLValueString($_POST['terminacion'], "text"),
                       
GetSQLValueString($_POST['sueldo_final'], "text"),
                       
GetSQLValueString($_POST['desde2'], "text"),
                       
GetSQLValueString($_POST['hasta2'], "text"),
                       
GetSQLValueString($_POST['empresa2'], "text"),
                       
GetSQLValueString($_POST['dir_empresa2'], "text"),
                       
GetSQLValueString($_POST['cargo_empresa2'], "text"),
                       
GetSQLValueString($_POST['jefe2'], "text"),
                       
GetSQLValueString($_POST['cargo_jefe2'], "text"),
                       
GetSQLValueString($_POST['terminacion2'], "text"),
                       
GetSQLValueString($_POST['sueldo_final2'], "text"),
                       
GetSQLValueString($_POST['desde3'], "text"),
                       
GetSQLValueString($_POST['hasta3'], "text"),
                       
GetSQLValueString($_POST['empresa3'], "text"),
                       
GetSQLValueString($_POST['dir_empresa3'], "text"),
                       
GetSQLValueString($_POST['cargo_empresa3'], "text"),
                       
GetSQLValueString($_POST['jefe3'], "text"),
                       
GetSQLValueString($_POST['cargo_jefe3'], "text"),
                       
GetSQLValueString($_POST['terminacion3'], "text"),
                       
GetSQLValueString($_POST['sueldo_final3'], "text"),
                       
GetSQLValueString($_POST['instituto'], "text"),
                       
GetSQLValueString($_POST['dir_instituto'], "text"),
                       
GetSQLValueString($_POST['anos_cur'], "text"),
                       
GetSQLValueString($_POST['inicio_inst'], "text"),
                       
GetSQLValueString($_POST['final_inst'], "text"),
                       
GetSQLValueString($_POST['titulo'], "text"),
                       
GetSQLValueString($_POST['instituto2'], "text"),
                       
GetSQLValueString($_POST['dir_instituto2'], "text"),
                       
GetSQLValueString($_POST['anos_cur2'], "text"),
                       
GetSQLValueString($_POST['inicio_inst2'], "text"),
                       
GetSQLValueString($_POST['final_inst2'], "text"),
                       
GetSQLValueString($_POST['titulo2'], "text"),
                       
GetSQLValueString($_POST['instituto3'], "text"),
                       
GetSQLValueString($_POST['dir_instituto3'], "text"),
                       
GetSQLValueString($_POST['anos_cur3'], "text"),
                       
GetSQLValueString($_POST['inicio_cur3'], "text"),
                       
GetSQLValueString($_POST['final_cur3'], "text"),
                       
GetSQLValueString($_POST['titulo3'], "text"),
                       
GetSQLValueString($_POST['instituto4'], "text"),
                       
GetSQLValueString($_POST['dir_instituto4'], "text"),
                       
GetSQLValueString($_POST['anos_cur4'], "text"),
                       
GetSQLValueString($_POST['inicio_inst4'], "text"),
                       
GetSQLValueString($_POST['final_inst4'], "text"),
                       
GetSQLValueString($_POST['titulo4'], "text"),
                       
GetSQLValueString($_POST['instituto5'], "text"),
                       
GetSQLValueString($_POST['dir_instituto5'], "text"),
                       
GetSQLValueString($_POST['anos_cur5'], "text"),
                       
GetSQLValueString($_POST['inicio_inst5'], "text"),
                       
GetSQLValueString($_POST['final_inst5'], "text"),
                       
GetSQLValueString($_POST['titulo5'], "text"),
                       
GetSQLValueString($_POST['nomape'], "text"),
                       
GetSQLValueString($_POST['direccion_ref'], "text"),
                       
GetSQLValueString($_POST['tel_ref'], "text"),
                       
GetSQLValueString($_POST['tiempo_ref'], "text"),
                       
GetSQLValueString($_POST['nomape2'], "text"),
                       
GetSQLValueString($_POST['direccion_ref2'], "text"),
                       
GetSQLValueString($_POST['tel_ref2'], "text"),
                       
GetSQLValueString($_POST['tiempo_ref2'], "text"));

  
mysql_select_db($database_pintor$pintor);
  
$Result1 mysql_query($insertSQL$pintor) or die(mysql_error());
}
?>
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...