Ver Mensaje Individual
  #14 (permalink)  
Antiguo 21/03/2014, 19:19
keivis
 
Fecha de Ingreso: julio-2013
Mensajes: 123
Antigüedad: 10 años, 9 meses
Puntos: 1
Respuesta: sos con registro a base de datos no registra

este es el resultado del var_dump me dice que tengo un error estoy revisando y de verdad no veo el error según la documentación la consulta no concuerda el numero de campo con los valores.

Código SQL:
Ver original
  1. string 'insert into nacimientos values('2014','4444','2014-03-22','jj','prueba','gerente','xxxx','III','14','EXTRANJERA','SOLTERA','000','MMMM','MMM','MMM','MMM','MMM','1','KKK','88','EXTRANJERO','SOLTERO','8888','VVV','VV','VVV','VV','VVV','0','JJJJ','1','2014-3-22','JJJJJJ','02','00','1','JJJ','JJJ','JJJ','SI','666','JJJJ','444','HHH','VVVVVVVV','333','21','VENEZOLANO(A)','CASADO(A)','AAA','AAA','AAA','AAA','AAA','AAA','NO','SIN NOTA MARGINAL','administrador');' (LENGTH=463)
  2. Error: COLUMN COUNT doesn't match value count at row 1

te muestro nuevamente los valores que recibo el query y la bd

Código PHP:
Ver original
  1. <?php
  2. include ("config.php");
  3. $con=mysql_connect($host,$user,$pass);
  4. if (!$con) {
  5. die('Problemas con el servidor: ' . mysql_error());
  6. }
  7. $db_selected = mysql_select_db($db,$con);
  8. if (!$db_selected) {
  9. die ('Error al conectar a la BD. : ' . mysql_error());
  10. }
  11. if (isset($_POST['guardar'])) {
  12.  
  13. $post_ano = $_POST['ano'];
  14. $post_numero = $_POST['numero'];
  15. $post_folio = $_POST['folio'];
  16. $post_fecha = $_POST['fecha'];
  17.  
  18. $post_aut = $_POST['nombre_aut'];
  19. $post_cargo = $_POST['cargo'];
  20. $post_cedula_aut = $_POST['cedula_aut'];
  21.  
  22. $post_nombre_nino = strtoupper($_POST['nombre_nino']);
  23. $post_sexo = $_POST['sexo'];
  24. $post_dia = $_POST['dia'];
  25. $post_mes = $_POST['mes'];
  26. $post_year = $_POST['year'];
  27. $post_nacido = strtoupper($_POST['nacido']);
  28. $post_hora = $_POST['hora'];
  29. $post_minutos = $_POST['minutos'];
  30. $post_am_pm = $_POST['am_pm'];
  31. $post_lugar_nino = strtoupper($_POST['lugar_nino']);
  32. $post_municipio_nino = strtoupper($_POST['municipio_nino']);
  33. $post_estado_nino = strtoupper($_POST['estado_nino']);
  34. $post_legitimo = strtoupper($_POST['legitimo']);
  35.  
  36. $post_nombre_testigo1 = strtoupper($_POST['nombre_testigo1']);
  37. $post_cedula_testigo1 = $_POST['cedula_testigo1'];
  38. $post_nombre_testigo2 = strtoupper($_POST['nombre_testigo2']);
  39. $post_cedula_testigo2 = $_POST['cedula_testigo2'];
  40.  
  41. $post_nombre_madre = strtoupper($_POST['nombre_madre']);
  42. $post_cedula_madre = $_POST['cedula_madre'];
  43. $post_edad_madre = $_POST['edad_madre'];
  44. $post_nacionalidad_madre = $_POST['nacionalidad_madre'];
  45. $post_civil_madre = $_POST['civil_madre'];
  46. $post_prof_madre = strtoupper($_POST['prof_madre']);
  47. $post_domicilio_madre = strtoupper($_POST['domicilio_madre']);
  48. $post_lugar_madre = strtoupper($_POST['lugar_madre']);
  49. $post_municipio_madre = strtoupper($_POST['municipio_madre']);
  50. $post_estado_madre = strtoupper($_POST['estado_madre']);
  51.  
  52. $post_nombre_padre = strtoupper($_POST['nombre_padre']);
  53. $post_cedula_padre = $_POST['cedula_padre'];
  54. $post_edad_padre = $_POST['edad_padre'];
  55. $post_nacionalidad_padre = $_POST['nacionalidad_padre'];
  56. $post_civil_padre = $_POST['civil_padre'];
  57. $post_prof_padre = strtoupper($_POST['prof_padre']);
  58. $post_domicilio_padre = strtoupper($_POST['domicilio_padre']);
  59. $post_lugar_padre = strtoupper($_POST['lugar_padre']);
  60. $post_municipio_padre = strtoupper($_POST['municipio_padre']);
  61. $post_estado_padre = strtoupper($_POST['estado_padre']);
  62.  
  63. $post_nombre_otro = strtoupper($_POST['nombre_otro']);
  64. $post_cedula_otro = $_POST['cedula_otro'];
  65. $post_edad_otro = $_POST['edad_otro'];
  66. $post_nacionalidad_otro = $_POST['nacionalidad_otro'];
  67. $post_civil_otro = $_POST['civil_otro'];
  68. $post_prof_otro = strtoupper($_POST['prof_otro']);
  69. $post_parentesco = strtoupper($_POST['parentesco']);
  70. $post_domicilio_otro = strtoupper($_POST['domicilio_otro']);
  71. $post_lugar_otro = strtoupper($_POST['lugar_otro']);
  72. $post_municipio_otro = strtoupper($_POST['municipio_otro']);
  73. $post_estado_otro = strtoupper($_POST['estado_otro']);
  74.  
  75. $post_usuario = $_SESSION['username'];
  76.  
  77.  
  78. $post_presentacion = $_POST['rad_presentacion'];
  79. if ($post_presentacion == 'rad_padre') {
  80.  $post_pre_padre = 1;
  81.  $post_pre_madre = 0;
  82.  $post_pre_otro = 0;
  83. }
  84.  
  85. if ($post_presentacion == 'rad_madre') {
  86.  $post_pre_padre = 0;
  87.  $post_pre_madre = 1;
  88.  $post_pre_otro = 0;
  89. }
  90.  
  91. if ($post_presentacion == 'rad_otro') {
  92.  $post_pre_padre = 0;
  93.  $post_pre_madre = 0;
  94.  $post_pre_otro = 1;
  95. }
  96.  
  97. $post_op_marginal = $_POST['rad_marginal'];
  98. $post_nota_marginal = strtoupper($_POST['nota_marginal']);
  99. if ($post_op_marginal == 'nota_si') {
  100.  $post_op_marginal_t = "SI";
  101. }
  102. if ($post_op_marginal == 'nota_no') {
  103.  $post_op_marginal_t = "NO";
  104. }
  105.  
  106. if ($post_am_pm == 'AM'){
  107.    $post_am_pm_t = 1;
  108. }
  109. if ($post_am_pm == 'PM'){
  110.    $post_am_pm_t = 2;
  111. }
  112. list($diax,$mesx,$aniox)=explode("-",$post_fecha);
  113. $post_fecha_t = "$aniox-$mesx-$diax";
  114.  
  115. $post_fecha_nac = "$post_year-$post_mes-$post_dia";
  116.  
  117. if ($post_sexo=="MASCULINO") {
  118.     $post_sexo_t = 1;
  119.     } else {
  120.     $post_sexo_t = 2;
  121. }
  122.  
  123. if ($_POST['ano'] <> "" and $_POST['numero'] <> "" and $_POST['folio'] <> "" and $_POST['fecha'] <> "" and $_POST['nombre_nino'] <> "" and $_POST['sexo'] <> "" and $_POST['dia'] <> "" and $_POST['mes'] <> "" and $_POST['year'] <> "" and $_POST['nacido'] <> "" and $_POST['hora'] <> "" and $_POST['minutos'] <> "" and $_POST['am_pm'] <> "" and $_POST['lugar_nino'] <> "" and $_POST['municipio_nino'] <> "" and $_POST['estado_nino'] <> "" and $_POST['nombre_testigo1'] <> "" and $_POST['cedula_testigo1'] <> "" and $_POST['nombre_testigo2'] <> "" and $_POST['cedula_testigo2'] <> "" and $_POST['nombre_madre'] <> "" and $_POST['cedula_madre'] <> "" and $_POST['edad_madre'] <> "" and $_POST['nacionalidad_madre'] <> "" and $_POST['civil_madre'] <> "" and $_POST['prof_madre'] <> "" and $_POST['domicilio_madre'] <> "" and $_POST['lugar_madre'] <> "" and $_POST['municipio_madre'] <> "" and $_POST['estado_madre'] <> "" and $_POST['nombre_padre'] <> "" and $_POST['cedula_padre'] <> "" and $_POST['edad_padre'] <> "" and $_POST['nacionalidad_padre'] <> "" and $_POST['civil_padre'] <> "" and $_POST['prof_padre'] <> "" and $_POST['domicilio_padre'] <> "" and $_POST['lugar_padre'] <> "" and $_POST['municipio_padre'] <> "" and $_POST['estado_padre'] <> "" and $_POST['rad_presentacion'] <> "" and $_POST['nombre_otro'] <> "" and $_POST['cedula_otro'] <> "" and $_POST['edad_otro'] <> "" and $_POST['nacionalidad_otro'] <> "" and $_POST['civil_otro'] <> "" and $_POST['prof_otro'] <> "" and $_POST['parentesco'] <> "" and $_POST['domicilio_otro'] <> "" and $_POST['lugar_otro'] <> "" and $_POST['municipio_otro'] <> "" and $_POST['estado_otro'] <> "" and $_POST['nota_marginal'] <> "") {
  124.  
  125.  
  126. $consulta="insert into nacimientos values('$post_ano','$post_numero','$post_fecha_t','$post_folio','$post_aut','$post_cargo','$post_cedula_aut','$post_nombre_madre','$post_edad_madre','$post_nacionalidad_madre','$post_civil_madre','$post_cedula_madre','$post_prof_madre','$post_domicilio_madre','$post_lugar_madre','$post_municipio_madre','$post_estado_madre','$post_pre_madre','$post_nombre_padre','$post_edad_padre','$post_nacionalidad_padre','$post_civil_padre','$post_cedula_padre','$post_prof_padre','$post_domicilio_padre','$post_lugar_padre','$post_municipio_padre','$post_estado_padre','$post_pre_padre','$post_nombre_nino','$post_sexo_t','$post_fecha_nac','$post_nacido','$post_hora','$post_minutos','$post_am_pm_t','$post_lugar_nino','$post_municipio_nino','$post_estado_nino','$post_legitimo','$post_cedula_testigo1','$post_nombre_testigo1','$post_cedula_testigo2','$post_nombre_testigo2','$post_nombre_otro','$post_cedula_otro','$post_edad_otro','$post_nacionalidad_otro','$post_civil_otro','$post_prof_otro','$post_parentesco','$post_domicilio_otro','$post_lugar_otro','$post_municipio_otro','$post_estado_otro','$post_op_marginal_t','$post_nota_marginal','$post_usuario');";
  127. var_dump ($consulta);
  128. $query = mysql_query($consulta) or die("Error: ". mysql_error());
  129. }}?>

esta en la bd

Código SQL:
Ver original
  1. CREATE TABLE IF NOT EXISTS `nacimientos` (
  2.   `ano` INT(11) NOT NULL,
  3.   `numero` INT(11) NOT NULL,
  4.   `fecha` DATE NOT NULL,
  5.   `folio` VARCHAR(20) NOT NULL,
  6.   `autoridad` VARCHAR(60) NOT NULL,
  7.   `cargo_autoridad` VARCHAR(60) NOT NULL,
  8.   `cedula_autoridad` INT(11) NOT NULL,
  9.   `nombre_madre` VARCHAR(60) NOT NULL,
  10.   `edad_madre` INT(11) NOT NULL,
  11.   `nacionalidad_madre` VARCHAR(20) NOT NULL,
  12.   `civil_madre` VARCHAR(15) NOT NULL,
  13.   `cedula_madre` INT(11) NOT NULL,
  14.   `prof_madre` VARCHAR(100) NOT NULL,
  15.   `domicilio_madre` VARCHAR(300) NOT NULL,
  16.   `ciudad_madre` VARCHAR(30) NOT NULL,
  17.   `municipio_madre` VARCHAR(20) NOT NULL,
  18.   `estado_madre` VARCHAR(20) NOT NULL,
  19.   `presenta_madre` INT(11) NOT NULL,
  20.   `nombre_padre` VARCHAR(60) NOT NULL,
  21.   `edad_padre` INT(11) NOT NULL,
  22.   `nacionalidad_padre` VARCHAR(20) NOT NULL,
  23.   `civil_padre` VARCHAR(15) NOT NULL,
  24.   `cedula_padre` INT(11) NOT NULL,
  25.   `prof_padre` VARCHAR(100) NOT NULL,
  26.   `domicilio_padre` VARCHAR(300) NOT NULL,
  27.   `ciudad_padre` VARCHAR(30) NOT NULL,
  28.   `municipio_padre` VARCHAR(20) NOT NULL,
  29.   `estado_padre` VARCHAR(20) NOT NULL,
  30.   `presenta_padre` INT(11) NOT NULL,
  31.   `nombre_nino` VARCHAR(60) NOT NULL,
  32.   `sexo_nino` INT(11) NOT NULL,
  33.   `fecha_nino` DATE NOT NULL,
  34.   `hospital` VARCHAR(100) NOT NULL,
  35.   `hora` INT(11) NOT NULL,
  36.   `minuto` INT(11) NOT NULL,
  37.   `am_pm` INT(11) NOT NULL,
  38.   `ciudad_nino` VARCHAR(30) NOT NULL,
  39.   `municipio_nino` VARCHAR(20) NOT NULL,
  40.   `estado_nino` VARCHAR(20) NOT NULL,
  41.   `legitimo` VARCHAR(2) NOT NULL,
  42.   `cedula_testigo1` INT(11) NOT NULL,
  43.   `nombre_testigo1` VARCHAR(60) NOT NULL,
  44.   `cedula_testigo2` INT(11) NOT NULL,
  45.   `nombre_testigo2` VARCHAR(60) NOT NULL,
  46.   `nombre_otro` VARCHAR(60) NOT NULL,
  47.   `cedula_otro` INT(11) NOT NULL,
  48.   `edad_otro` INT(11) NOT NULL,
  49.   `nacionalidad_otro` VARCHAR(20) NOT NULL,
  50.   `civil_otro` VARCHAR(15) NOT NULL,
  51.   `prof_otro` VARCHAR(100) NOT NULL,
  52.   `parentesco` VARCHAR(30) NOT NULL,
  53.   `domicilio_otro` VARCHAR(200) NOT NULL,
  54.   `ciudad_otro` VARCHAR(30) NOT NULL,
  55.   `municipio_otro` VARCHAR(20) NOT NULL,
  56.   `estado_otro` VARCHAR(20) NOT NULL,
  57.   `op_marginal` VARCHAR(2) NOT NULL,
  58.   `nota_marginal` text NOT NULL,
  59.   `usuario` VARCHAR(20) NOT NULL

Gracias por la ayuda.