Ver Mensaje Individual
  #12 (permalink)  
Antiguo 02/04/2012, 08:59
elkumanes1
 
Fecha de Ingreso: marzo-2012
Mensajes: 17
Antigüedad: 12 años, 1 mes
Puntos: 0
Respuesta: formulario para buscar en base de datos un registro

mira hice este como me digiste pero no me arroja resultado la pagina queda en blanco, solo me manda a la pagina de inicio

Código PHP:
<?php
if(isset($_POST['nomb'])) 

    if(!empty(
$_POST['nombre'])) 
    {     






$conexion mysql_connect("localhost""root""16313024");
mysql_select_db("registro"$conexion);

$queEmp "SELECT * FROM alumnos WHERE ID='$nombre';" or die ("Error en la consulta");
$resEmp mysql_query($queEmp$conexion) or die(mysql_error());
 
        
desconectar(); 
$totEmp mysql_num_rows($resEmp);


if(
$totEmp>0
        { 
            while (
$rowEmp mysql_fetch_assoc($resEmp))  
            {  
                    echo 
"Nombre: <strong>".$rowEmp['nombre']."</strong><br></br>";  
                    echo 
"Apellidos:<strong>".$rowEmp['apellido']."</strong><br></br>";  
                    echo 
"Nota Primer Lapso: ".$rowEmp['nota1']."<br></br>";  
                    echo 
"Nota Segundo Lapso: ".$rowEmp['nota2']."<br></br>";  
                    echo 
"Nota Tercer Lapso: ".$rowEmp['nota3']."<br></br>";  
                    echo 
"Nota Definitiva: ".$rowEmp['nota_final']."<br></br>";  
            } 
        } 
        else 
        { 
            
header("location:index.php");  
        } 
    } 
    else 
    { 
        
header("location:index.php");  
    }     

else 

    
header("location:index.php");      

?>

y le cambie la linea 2 a mi codigo y ya no me sale el erro pero me sale tambien la pagina en blanco no me arroja los resultados este es mi codigo


Código PHP:
<?php
$nombre 
= isset($_POST['nomb']); // esta es la linea 2 donde estaba el error
$conexion mysql_connect("localhost""root""16313024");
mysql_select_db("registro"$conexion);

$queEmp "SELECT * FROM alumnos WHERE ID='$nombre';" or die ("Error en la consulta");
$resEmp mysql_query($queEmp$conexion) or die(mysql_error());
$totEmp mysql_num_rows($resEmp);
if (!
$totEmp)
{
echo 
"Usted no ve Clase con este Profesor";
exit;
}
?>

<style type="text/css">
<!--
body {
font-family: "Trebuchet MS", Tahoma, Verdana;
font-size: 14px;
font-weight: normal;
color: #666666;
text-decoration: none;
padding: 20px;
}
h4 {
color: #CC0000;
}
-->
</style>
</head>
<body>
<h4 class="Estilo2">Informacion Personal</h4>
<?php 
if ($totEmp0) {
while (
$rowEmp mysql_fetch_assoc($resEmp)) {
echo 
"Nombre: <strong>".$rowEmp['nombre']."</strong><br></br>";
echo 
"Apellidos:<strong>".$rowEmp['apellido']."</strong><br></br>";
echo 
"Nota Primer Lapso: ".$rowEmp['nota1']."<br></br>";
echo 
"Nota Segundo Lapso: ".$rowEmp['nota2']."<br></br>";
echo 
"Nota Tercer Lapso: ".$rowEmp['nota3']."<br></br>";
echo 
"Nota Definitiva: ".$rowEmp['nota_final']."<br></br>";

}
}
?>

Última edición por elkumanes1; 02/04/2012 a las 09:31