Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/06/2013, 08:09
migferpedia77
 
Fecha de Ingreso: marzo-2012
Mensajes: 21
Antigüedad: 12 años, 2 meses
Puntos: 0
FAllo al escribir en base de datos

Hola a todos

Estoy desarrollando un archivo para escribir en una base de datos que es un poco larga, creo, pero que tiene 4 tablas, creo la conexión y el código del insert y todo funciona escribiendo en un a sola tabla, pero al colocar el código para las otras tablas ya no me funciona y solo escribe en la primera y en las otras no.

Este es el código

include("kidConection.php");

conection();

$kidFecha=$_POST[ini_date];
$kidName=$_POST[kidName];
$kidId=$_POST[kidId];
$kidMom=$_POST[kidMom];
$kidDad=$_POST[kidDad];
$kidAge=$_POST[kidAge];
$kidSize=$_POST[kidSize];
$kidPhone=$_POST[kidPhone];
$kidCel=$_POST[kidCel];
$kidEmail=$_POST[kidEmail];
$consent1=$_POST[consent1];
$consent2=$_POST[consent2];
$consent3=$_POST[consent3];

$kidNumber=$_POST[kidId];
$kidChildName=$_POST[kidName];
$kidParentName=$_POST[parentName];
$dadHomePhone=$_POST[houseTel];
$dadOfficePhone=$_POST[officeTel];
$dadCelPhone=$_POST[celNumber];

$erContact1=$_POST[contactName1];
$erPhone1=$_POST[contactTel1];
$erCel1=$_POST[contactCel1];

$erContact2=$_POST[contactName2];
$erPhone2=$_POST[contactTel2];
$erCel2=$_POST[contactCel2];

$kidEps=$_POST[epsName];
$kidEpsCotiz=$_POST[epsCot];
$kidDeseases=$_POST[deseases];
$kidOtherDes=$_POST[cronic];
$kidAllergies=$_POST[allergies];
$kidAllergiesEspec=$_POST[especAlergies];
$kidAnotherDes=$_POST[anotherDiseases];
$kidMedicalCare=$_POST[medical];
$kidMedExam1=$_POST[seriousIllnes];
$kidMedExam2=$_POST[seriousIllnes1];
$kidMedExam3=$_POST[seriousIllnes2];
$kidHospCare=$_POST[hospCare];
$kidPhisAct=$_POST[phisAct];
$kidPhisActEspec=$_POST[phisActEspec];
$kidDrugs=$_POST[drugs];
$kidDrugsEspec=$_POST[drugsEspec];
$kidMedCond=$_POST[medCond];
$kidMedCondEsp=$_POST[medCondEsp];
$kidInfection=$_POST[kidInfection];
$kidInfectionEsp=$_POST[kidInfectionEsp];
$kidGenCond=$_POST[genCond];
$kidDoctor=$_POST[docName];
$kidDocPhone=$_POST[docPhone];
$kidPhysical=$_POST[kidPhysical];
$kidPhysEspec=$_POST[kidPhysEspec];
$kidPhysFinal=$_POST[physFinal];
$kidPhysFinalEspec=$_POST[physFinalEspec];

$sql=("INSERT INTO datoskids(kidFecha, kidName, kidId, madre, padre, age, altura, numTel, numCel, email) VALUES ('$kidFecha', '$kidName', '$kidId', '$kidMom', '$kidDad', '$kidAge', '$kidSize', '$kidPhone', '$kidCel', '$kidEmail')");

$sql1=("INSERT INTO consent(kidId, kidName, consent1, consent2, consent3)VALUES('$kidNumber', '$kidChildName', '$consent1', '$consent2', '$consent3')");

$sql2=("INSERT INTO kidshealth(kidId, kidParentName, dadHomePhone, dadofficePhone, dadCelPhone, erContact1, erPhone1, erCel1, erContact2, erPhone2, erCel2, kidEps, kidEpsCotiz, kidDeseases, kidOtherDes, kidAllergies, kidAllergiesEspec, kidAnotherDes, kidMedicalCare, kidMedExam1, kidMedExam2, kidMedExam3, kidHospCare, kidPhisAct, kidPhisActEspec, kidDrugs, kidDrugsEspec, kidMedCond, kidMedCondEsp, kidInfection, kidInfecEsp, kidGenCond, kidDoctor, kidDocPhone, kidPhysical, kidPhysEspec, kidPhisFinal, kidPhysFinalEsp)
VALUES('$kidId', $kidParentName', '$dadHomePhone', '$dadOfficePhone', '$dadCelPhone', '$erContact1', '$erPhone1', '$erCel1', '$erContact2', '$erPhone2', '$erCel2', '$kidEps', '$kidEpsCotiz', '$kidDeseases', '$kidOtherDes', '$kidAllergies', '$kidAllergiesEspec', '$kidAnotherDes', '$kidMedicalCare', '$kidMedExam1', '$kidMedExam2', '$kidMedExam3', '$kidHospCare', '$kidPhisAct', '$kidPhisActEspec', '$kidDrugs', '$kidDrugsEspec', '$kidMedCond', '$kidMedCondEsp', '$kidInfection', '$kidInfectionEsp', '$kidGenCond', '$kidDoctor', '$kidDocPhone', '$kidPhysical', '$kidPhysEspec', '$kidPhysFinal', '$kidPhysFinalEspec')");

$escribir1=mysql_query($sql);
$escribir2=mysql_query($sql1);
$escribir3=mysql_query($sql2);
//$escribir4=mysql_query($sql3);

if($escribir1==false){
echo "Fallo al escribir en tabla 1";
}


if($escribir2==false){
echo "Fallo al escribir en tabla 2";
}

if($escribir3==false){
echo "Fallo al escribir en tabla 3";
}

if($escribir4==false){
echo "Fallo al escribir en tabla 4";
}

Si alguien me puede decir que estoy haciendo mal o si es que un mismo archivo no puedo colocar tantos insert, bueno hasta ya revise todos los insert y los archivos y ya no hay errores en escritura, creo.

Si alguien me puede colaborar lo antes posible por que ya estoy retrasado en este primer proyecto, les agradecería grandemente..