Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/03/2012, 13:32
Avatar de erick_reyesg
erick_reyesg
 
Fecha de Ingreso: enero-2012
Ubicación: Guatemala
Mensajes: 53
Antigüedad: 12 años, 3 meses
Puntos: 2
Porque no me funciona este codigo???? alguien?'?

pues el error que me da es que si la tabla sql esta vacia no me muestra el formulario que es en estas lineas si el usuario ya esta en la tabla con la fecha de hoy muestra ya evaluado de lo contrario deberia mostrar el formulario pero no lo hace y le puse otra conexion porq? por q la db del form es diferenta ayuda plz

Código PHP:
if ($user == $usuario  && $fech == $fecha){
        echo 
"<p style='font-family:Tahoma, Geneva'><b>Ya Te Evaluaste Hoy tu nota es $not</b></p> <br><br>";
        echo 
"<a href='form.php'>    <img src='images/volver.png' /></a>";
        return 
0;
           }
           else{
$conexion mysql_connect("localhost""root""ene2012");
    
mysql_select_db("usuarios"$conexion);
    
$queEmp "SELECT * FROM cuestionario";
    
$resEmp mysql_query($queEmp$conexion) or die(mysql_error());
    
$totEmp mysql_num_rows($resEmp);      
echo 
"<form action='resultado.php' method='post' name='formulario'>";
echo 
"<table>";

       while (
$rowEmp mysql_fetch_assoc($resEmp)) {
       
$corre1 $rowEmp['corre1'];
       
$corre2 $rowEmp['corre2'];
       
$corre3 $rowEmp['corre3'];
       
$corre4 $rowEmp['corre4'];        
           
          echo 
"<strong>".$rowEmp['pregunta1']."</strong><br>";
          echo 
"<tr><td><input type='radio' name='Res1' value='1'>";
          echo 
"".$rowEmp['1res1']."<br>";
    echo 
"<input type='radio' name='Res1' value='2'>";
          echo 
"".$rowEmp['1res2']."<br>"
    echo 
"<input type='radio' name='Res1' value='3'>";
          echo 
"".$rowEmp['1res3']."<br>"
    echo 
"<input type='radio' name='Res1' value='4'>";
          echo 
"".$rowEmp['1res4']."<br></td></tr>";   
echo 
"</table><br>"



Código PHP:
    <?php
    $usuario 
$_COOKIE['loggedin'];
    if (!isset(
$_COOKIE['loggedin'])) die("<center><img src='images/error.png'><br><div id='miclase'>No te has identificado, <a href=index.html>click ac&aacute;</a> para iniciar sesi&oacute;n.</center>");
     
                 
$conexion mysql_connect("localhost""root""ene2012");
        
mysql_select_db("usuarios"$conexion);
        
$queEmp "SELECT * FROM notas_cues WHERE usuario ='$usuario'"// WHERE usuario ='$usuario'
        
$resEmp mysql_query($queEmp$conexion) or die(mysql_error());
        
$totEmp mysql_num_rows($resEmp);  
        
$nom $qry['nombre'];
//$jdv = $qry['jjvv'];
    
echo "Usuario: <input type='text'  name='matricula' size='8' readonly value='$usuario'>&nbsp;&nbsp;&nbsp;";
//echo "    <input type='text' name='nombre' value='$nom'>";
//echo "    <input type='text' name='jefe' value='$jdv'>";




    
echo "Fecha &nbsp;&nbsp;&nbsp;";
    
$fecha date('d/m/y');
    echo 
$fecha;
    echo 
"<br><br>";


           while (
$rowEmp mysql_fetch_assoc($resEmp)) {
    
$not $rowEmp['nota'];
    
$user $rowEmp['usuario'];
    
$fech $rowEmp['fecha'];
     
    if (
$user == $usuario  && $fech == $fecha){
        echo 
"<p style='font-family:Tahoma, Geneva'><b>Ya Te Evaluaste Hoy tu nota es $not</b></p> <br><br>";
        echo 
"<a href='form.php'>    <img src='images/volver.png' /></a>";
        return 
0;
           }
           else{
$conexion mysql_connect("localhost""root""ene2012");
    
mysql_select_db("usuarios"$conexion);
    
$queEmp "SELECT * FROM cuestionario";
    
$resEmp mysql_query($queEmp$conexion) or die(mysql_error());
    
$totEmp mysql_num_rows($resEmp);      
echo 
"<form action='resultado.php' method='post' name='formulario'>";
echo 
"<table>";

       while (
$rowEmp mysql_fetch_assoc($resEmp)) {
       
$corre1 $rowEmp['corre1'];
       
$corre2 $rowEmp['corre2'];
       
$corre3 $rowEmp['corre3'];
       
$corre4 $rowEmp['corre4'];        
           
          echo 
"<strong>".$rowEmp['pregunta1']."</strong><br>";
          echo 
"<tr><td><input type='radio' name='Res1' value='1'>";
          echo 
"".$rowEmp['1res1']."<br>";
    echo 
"<input type='radio' name='Res1' value='2'>";
          echo 
"".$rowEmp['1res2']."<br>"
    echo 
"<input type='radio' name='Res1' value='3'>";
          echo 
"".$rowEmp['1res3']."<br>"
    echo 
"<input type='radio' name='Res1' value='4'>";
          echo 
"".$rowEmp['1res4']."<br></td></tr>";   
echo 
"</table><br>";
 
 
echo 
"<table>";
          echo 
"<strong>".$rowEmp['pregunta2']."</strong><br>";
          echo 
"<tr><td><input type='radio' name='Res2' value='1'>";
          echo 
"".$rowEmp['2res1']."<br>";
    echo 
"<input type='radio' name='Res2' value='2'>";
          echo 
"".$rowEmp['2res2']."<br>"
    echo 
"<input type='radio' name='Res2' value='3'>";
          echo 
"".$rowEmp['2res3']."<br>"
    echo 
"<input type='radio' name='Res2' value='4'>";
          echo 
"".$rowEmp['2res4']."<br></td></tr>";   
echo 
"</table><br>";
echo 
"<br>";
 
 
 
echo 
"<table>";
          echo 
"<strong>".$rowEmp['pregunta3']."</strong><br>";
          echo 
"<tr><td><input type='radio' name='Res3' value='1'>";
          echo 
"".$rowEmp['3res1']."<br>";
    echo 
"<input type='radio' name='Res3' value='2'>";
          echo 
"".$rowEmp['3res2']."<br>"
    echo 
"<input type='radio' name='Res3' value='3'>";
          echo 
"".$rowEmp['3res3']."<br>"
    echo 
"<input type='radio' name='Res3' value='4'>";
          echo 
"".$rowEmp['3res4']."<br></td></tr>";   
echo 
"</table><br>";

 
echo 
"<input type='image' src='images/nota.png' />";
echo 
"</form>";

       }
              }
    }

    
?>
__________________
No hay Mayor señal de Ignoracia que creer imposible lo Inexplicable