Foros del Web » Programando para Internet » PHP »

ingreso de datos incorrecto

Estas en el tema de ingreso de datos incorrecto en el foro de PHP en Foros del Web. hola otra ves....tengo le siguiente problema...... estoy ingresando,puntajes de alumnos,y solo me esta ingresando le ultimo registro, y no se ah q puede ser,me gustaria ...
  #1 (permalink)  
Antiguo 14/09/2007, 08:28
 
Fecha de Ingreso: mayo-2007
Mensajes: 413
Antigüedad: 16 años, 11 meses
Puntos: 0
ingreso de datos incorrecto

hola otra ves....tengo le siguiente problema......

estoy ingresando,puntajes de alumnos,y solo me esta ingresando le ultimo registro, y no se ah q puede ser,me gustaria que me orientarano si necesitan codigo me dicen,gracias a todos
__________________
Los que Saben....no Saben lo que Saben
  #2 (permalink)  
Antiguo 14/09/2007, 08:40
Avatar de gerson  
Fecha de Ingreso: febrero-2005
Ubicación: Lima
Mensajes: 481
Antigüedad: 19 años, 2 meses
Puntos: 4
Re: ingreso de datos incorrecto

Hola natashca pues seria bueno q coloques tu script para poder ayudarte, lo que se me ocurre es que no estes haciendo un bucle para guardar tus datos...

Saludos
__________________

  #3 (permalink)  
Antiguo 14/09/2007, 08:51
 
Fecha de Ingreso: mayo-2007
Mensajes: 413
Antigüedad: 16 años, 11 meses
Puntos: 0
Re: ingreso de datos incorrecto

Código PHP:
<div id="Layer3" style="position:absolute; width:129px; height:280px; z-index:30; left: 17px; top: 98px">
    <div align="left"> <font face="Arial, Helvetica, sans-serif">
      
      <select name="select" size="18" id='select' onChange='MostrarNombre(this)'>//FUNCION PARA MOSTRAR LOS DATOS AL ALDO DE LA PANTALLA
     
        
<?php
$compara
==$select;
include 
"link.php";
$dblink=mysql_connect($MySqlHostname$MySqlUsername$MySqlPassword);
mysql_select_db("$MySqlDatabase");
$sql "SELECT  DISTINCT CORRELATIVO , PATERNO , MATERNO, RUT, DV, EDADACTUAL, PROMCAST7, PROMMAT7, PROMCAST8, PROMMAT8, NCURREP, TIENEPATROCINIO , NOMBRES FROM POSTULANTE ORDER BY PATERNO";

$query mysql_query($sql$dblink);

while (
$row mysql_fetch_array($query))
{
 
$PATERNOZ $row['PATERNO'];
 
$MATERNOZ $row['MATERNO'];
 
$NOMBRESZ $row['NOMBRES'];
 
$CORR $row['CORRELATIVO'];
 
$RUTZ $row['RUT'];
 
$DVZ $row['DV'];
 
 
$EDADACTUAL $row['EDADACTUAL'];
$PROMCAST7 $row['PROMCAST7'];
$PROMMAT7 $row['PROMMAT7'];
$PROMCAST8 $row['PROMCAST8'];
$PROMMAT8 $row['PROMMAT8'];
$NCURREP $row['NCURREP'];
$TIENEPATROCINIO $row['TIENEPATROCINIO'];

$sqll="SELECT * FROM FACTORES_TP";
$queryy=@mysql_query($sqll$dblink);
while (
$row mysql_fetch_array($queryy))
{
$FTP_PEDAD13 $row['FTP_PEDAD13'];
$FTP_PEDAD14 $row['FTP_PEDAD14'];
$FTP_PEDAD15 $row['FTP_PEDAD15'];
$FTP_PEDAD16 $row['FTP_PEDAD16'];
$FTP_PEDAD17 $row['FTP_PEDAD17'];
$FTP_F1 $row['FTP_F1'];
$FTP_MENOSVALOR $row['FTP_MENOSVALOR'];
$FTP_DIVVALOR $row['FTP_DIVVALOR']; //100
$FTP_F2 $row['FTP_F2'];
$FTP_F3 $row['FTP_F3'];
$FTP_F4 $row['FTP_F4'];
$FTP_F5 $row['FTP_F5'];
$FTP_F6 $row['FTP_F6'];
$FTP_PCURREP0 $row['FTP_PCURREP0'];
$FTP_PCURREP1 $row['FTP_PCURREP1'];
$FTP_PCURREP2 $row['FTP_PCURREP2'];
$FTP_FAE $row['FTP_FAE'];
$FTP_FTP $row['FTP_FTP'];
$FTP_N_ACEPTADOS_PROX $row['FTP_N_ACEPTADOS_PROX'];

$band=1;

if (
$EDADACTUAL<=13)
         { 
$temp_PTJEEDAD=$FTP_PEDAD13;
           
$band=1;
         }

     elseif (
$EDADACTUAL==14)
        { 
$temp_PTJEEDAD=$FTP_PEDAD14;
         
$band=1;
         }
        elseif (
$EDADACTUAL==15)
         { 
$temp_PTJEEDAD=$FTP_PEDAD15;
        
$band=1;
         }
             elseif (
$EDADACTUAL==16)
              { 
$temp_PTJEEDAD=$FTP_PEDAD16;
           
$band=1;
              }

$TP_PTJEEDAD=($temp_PTJEEDAD*$FTP_F1);

if (
$FTP_DIVVALOR !=0){
 
$TP_PPC7a=(($PROMCAST7-$FTP_MENOSVALOR )/$FTP_DIVVALOR);
 
$TP_PPC7=bcadd($TP_PPC7a03);

 
$TP_PPM7a=(($PROMMAT7-$FTP_MENOSVALOR )/$FTP_DIVVALOR);
 
$TP_PPM7=bcadd($TP_PPM7a03);

 
$TP_PPM8a=(($PROMMAT8-$FTP_MENOSVALOR )/$FTP_DIVVALOR);
 
$TP_PPM8=bcadd($TP_PPM8a03);

 
$TP_PPC8a=(($PROMCAST8-$FTP_MENOSVALOR )/$FTP_DIVVALOR);
 
$TP_PPC8=bcadd($TP_PPC8a03);

 
$TP_PPC7PORa=($TP_PPC7*$FTP_F4);
 
$TP_PPC7POR=bcadd($TP_PPC7PORa03);

 
$TP_PPC8PORa=($TP_PPC8*$FTP_F5);
 
$TP_PPC8POR=bcadd($TP_PPC8PORa03);

 
$TP_PPM7PORa=($TP_PPM7*$FTP_F2);
 
$TP_PPM7POR=bcadd($TP_PPM7PORa03);

 
$TP_PPM8PORa=($TP_PPM8*$FTP_F3);
 
$TP_PPM8POR=bcadd($TP_PPM8PORa03);

}

if (
$NCURREP==0)
{
$temp_PtjeCurRep=$FTP_PCURREP0;
}

elseif (
$NCURREP==1)
{
$temp_PtjeCurRep=$FTP_PCURREP1;
}

else
{
$temp_PtjeCurRep=$FTP_PCURREP2;
}


$TP_PTJECURREP=($temp_PtjeCurRep*$FTP_F6);

$ABa=(($TP_PTJEEDAD)+($TP_PPM7POR)+($TP_PPM8POR)+($TP_PPC7POR)+($TP_PPC8POR)+($TP_PTJECURREP));
$AB=bcadd($ABa03);

//$CORR==$compara;
$ResAB=($AB*$FTP_FAE);
$TP_PPSa=(($AB*$FTP_FAE)+($nota*$FTP_FTP));
$TP_PPS=bcadd($TP_PPSa03);

printf("<OPTION value=\" $PATERNOZ $MATERNOZ $NOMBRESZ <br> Nº de Registro: $CORR <br> Rut: $RUTZ  - $DVZ <br>$EDADACTUAL - $temp_PTJEEDAD<br>$PROMCAST7 - $TP_PPC7<br>$PROMMAT7 - $TP_PPM7<br>$PROMMAT8 - $TP_PPC8<br>$PROMCAST8 - $TP_PPC8<br>$NCURREP - $temp_PtjeCurRep<br>$nota<br>$TP_PPS<br>\", "); 


if (
$CORR==$compara
{

printf("SELECTED");

}
printf(">$PATERNOZ $MATERNOZ $NOMBRESZ </option>");
}
}
mysql_free_result($query);
?>

</select>

      </font></div>
  </div>
y esto es para ingresar los datos

Código PHP:
$sql4="INSERT INTO TEST_PRESELECCION22 VALUES ('$CORR', '', '1', '$RUTZ', now(), '$temp_PTJEEDAD', '$TP_PPC7', '$TP_PPM7', '$TP_PPM8', '$TP_PPC8', '$TP_PPC7POR', '$TP_PPM7POR', '$TP_PPC8POR', '$TP_PPM8POR', '$temp_PtjeCurRep', '$AB', '$nota', '$TP_PPS')";
$query4=@mysql_query($sql4$dblink); 
bueno ojala me puedas ayudar gracias
__________________
Los que Saben....no Saben lo que Saben
  #4 (permalink)  
Antiguo 14/09/2007, 09:08
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Re: ingreso de datos incorrecto

En el codigo que posteas solo estas haciendo un INSERT, es natural que solo se inserte un registro, si quieres almacenar multiples registros tendras que hacer un bucle y por cada alumno hacer el INSERT.

Saludos.
  #5 (permalink)  
Antiguo 14/09/2007, 09:21
 
Fecha de Ingreso: mayo-2007
Mensajes: 413
Antigüedad: 16 años, 11 meses
Puntos: 0
Re: ingreso de datos incorrecto

ahhhh ...ya gracias .lo hice..ahora guarda todos los registros.....el problema se presenta en la variable $nota....ingrese una nota y guarda la misma para todos

y se que tengo que insertar un update pero tambien lo hago dentro del bucle y me manda error...

Código PHP:
//$sql11 = "UPDATE TEST_PRESELECCION22 SET  CORR='$CORR' , RUTZ='$RUTZ', temp_PTJEEDAD='$temp_PTJEEDAD' , TP_PPC7='$TP_PPC7', TP_PPM7='$TP_PPM7' , TP_PPM8='$TP_PPM8' , TP_PPC8='$TP_PPC8',  TP_PPC7POR='$TP_PPC7POR' , TP_PPM7POR='$TP_PPM7POR' , TP_PPC8POR='$TP_PPC8POR', TP_PPM8POR='$TP_PPM8POR', temp_PtjeCurRep='$temp_PtjeCurRep' , AB='$AB' , nota='$nota' , TP_PPS='$TP_PPS' WHERE (RUTZ='$RUTZ')";
//$query11 = @mysql_query($sql11, $dblink); 
talves el where no va ahi ?? gracias por tu ayuda gator v
__________________
Los que Saben....no Saben lo que Saben
  #6 (permalink)  
Antiguo 14/09/2007, 09:57
 
Fecha de Ingreso: agosto-2006
Mensajes: 16
Antigüedad: 17 años, 7 meses
Puntos: 0
Re: ingreso de datos incorrecto

El WHERE no va entre parentesis y por supuesto las lineas esas para que actuen deben ir descomentadas (Quitando //)

Saludos
  #7 (permalink)  
Antiguo 14/09/2007, 10:16
 
Fecha de Ingreso: mayo-2007
Mensajes: 413
Antigüedad: 16 años, 11 meses
Puntos: 0
Re: ingreso de datos incorrecto

ahhh por supuesto que tengo que sacar los // es solo que lo escribi asi...ya saque los parentesis.....

pero pasa el siguiente problema.....

esta guardando el puntaje del ultimo registro y ese puntaje tambien lo guarda para todos los registros...es decir que si yo ingreso un puntaje guarda pero guarda el mismo para todos los registros..yo pienso que toma como valor el ultimo registro y guarda a el el puntaje y como esta en un bucle todos campturan el mismo puntaje...

sabes porque pasara esto...gracias
__________________
Los que Saben....no Saben lo que Saben
  #8 (permalink)  
Antiguo 14/09/2007, 13:22
 
Fecha de Ingreso: mayo-2007
Mensajes: 413
Antigüedad: 16 años, 11 meses
Puntos: 0
Re: ingreso de datos incorrecto

nadie sabe mi ultima duda???
__________________
Los que Saben....no Saben lo que Saben
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:53.