elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Introducción a Git (Primera Parte)


  Mostrar Temas
Páginas: [1]
1  Foros Generales / Dudas Generales / consulta msql en tablas con campos ID en: 29 Agosto 2014, 23:54 pm
Hola a todos y todas.
Estoy haciendo una consulta  a una tabla donde hay un campo Id.
Todo bien, pero en la respuesta correspondiente al Id me responde con un numero (que es el que corresponde a la respuesta de texto).
Cuál sería el script correcto para que en vez del número aparezca el nombre correspondiente al examen?
Este es el script que tengo y cuando lo ejecuto me dice :Indefined index: result2 in C:....



<?php
    include ("conexion.php");
   
?>

<html>
    <meta http-equiv="Content-type" content="text/html; charset=utf8" />
    <head>
    <title>Alumnos</title>
        </head>
    <body>
    <center>
    <br>
   
    <?php
    mysql_query("set names 'iso-8859-1'");
       
    $documento=$_POST['nombre'];
    $tabla="pag_alumn";

$sql = "SELECT   nombre,identificacion, apellidos,telefono,Idexam_alumn,profesor,factura,hor_por_pagar,saldo_por_pagar,fe_saldo FROM $tabla where nombre='$documento' AND (saldo_por_pagar NOT IN (0))  ORDER BY fe_saldo";

   
$result = mysql_query($sql);

    $result = mysql_query("SELECT  nombre,identificacion,  apellidos, telefono,Idexam_alumn ,profesor,factura,hor_por_pagar,saldo_por_pagar,fe_saldo FROM $tabla where nombre='$documento' AND (saldo_por_pagar NOT IN (0)) ORDER BY fe_saldo");



$exam = 'Idexam_alumn';

$result2 = mysql_query("SELECT examen, from exámenes where Idexam_alumn='$exam'");

     if ($row = mysql_fetch_array($result))
{
    echo "<table border = '1'><caption align='top'><font color=red><big><big><strong>SALDOS ALUMNOS</strong></font></big></caption> \n";
    echo "<tr></td><th><strong><font color = blue>Nombre</font></strong></td><th><strong><font color =blue>Apellidos</FONT></strong></td><th><strong><font color = blue>Identificacion</font></strong></td><th><strong><font color = blue>Tel&eacute;fono</font></strong></td><th><strong><font color = blue>Examen</font></strong></td><th><strong><font color = blue>Profesor</font></strong></td><th><strong><font color = blue>Factura</font></strong></td><th><strong><font color =darkness red>Horas por pagar</font></strong></td><th><strong><font color =darkness red>Saldo por Pagar</font></strong></td><th><strong><font color = darkness red>Fecha Saldo</font></strong></td></th></tr> \n";
    do {
    echo "<tr><td>".$row["nombre"]."</td><td>".$row["apellidos"]."</td><td>".$row["identificacion"]."</td><td>".$row["telefono"]."</td><td>".$row["result2"]."</td><td>".$row["profesor"]."</td><td>".$row["factura"]."</td><td>".$row["hor_por_pagar"]."</td><td>".$row["saldo_por_pagar"]."</td><td>".$row["fe_saldo"]."</td></tr> \n";
    } while ($row = mysql_fetch_array($result));


    echo "</table>";
    } else {
    echo "! No se ha encontrado ningun registro !";
    }
    ?>
   

    </center>
    </body>
</html>
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines