Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/11/2005, 02:29
atiro8
 
Fecha de Ingreso: octubre-2005
Mensajes: 151
Antigüedad: 18 años, 5 meses
Puntos: 1
Primer registro no aparece

Haber si puede alguien echarme un guante, hago una consulta a la base de datos y dos bucles para que me aparezcan las preguntas y las respuestas y el primer registro desaparece, el codigo es:

<?
//no puede ninguna línea vacía al principio
//Incluyo el mecanismo de control
$URL = $_SERVER['PHP_SELF'];
include "../../admin/controlSession.php";
?>
<?php require_once('../../Connections/conect.php'); ?>
<?php
$cod_tema=$_GET['cod_tema'];
$cod_curso=$_GET['cod_curso'];
$num_test=$_GET['num_test'];
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #6699FF;
}
.Estilo5 {
font-family: Arial, Helvetica, sans-serif;
color: #00FFFF;
}
.Estilo6 {
color: #FFFFFF;
font-size: 14px;
}
.Estilo7 {
color: #FF0000;
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
}
a {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #FFFFFF;
}
a:visited {
color: #FFFFFF;
}
a:hover {
color: #FF0000;
}
a:active {
color: #FFFFFF;
}
.Estilo10 {font-family: Arial, Helvetica, sans-serif; color: #6699FF; }
.Estilo11 {color: #FFFFFF}
-->
</style></head>

<body>
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0">


<tr>
<td colspan="3"><table width="770" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
<tr>
<td><div align="center"><img src="../images/portada/banner.jpg" width="770" height="100"></div></td>
</tr>
</table></td>
</tr>
<tr>
<td><a href="javascript:history.go(-1);">volver</a></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td valign="top"><?php echo $totalpreguntas ?></td>
<td valign="top"><table width="500" border="1" align="center" cellpadding="10" cellspacing="0" bordercolor="#FFFFFF">
<tr>
<td><span class="Estilo7"></span></td>
</tr>
<tr>
<td><div align="center">
<table width="500" border="1" cellspacing="0" cellpadding="0">
<?php
mysql_select_db($database_conect, $conect);
$query_preguntas = "SELECT pregunta,cod_pregunta FROM db_listado_test_preguntas WHERE cod_tema='".$cod_tema."' and cod_curso='".$cod_curso."' and num_test='".$num_test."'";
$preguntas = mysql_query($query_preguntas, $conect) or die(mysql_error());
$row_preguntas = mysql_fetch_assoc($preguntas);
$totalpreguntas = mysql_num_rows($preguntas);

if($totalpreguntas>0){
while(list($pregunta,$cod_pregunta)=mysql_fetch_ar ray($preguntas)){


echo"<tr><td><div align='left'>$pregunta</div></td> </tr>";



$query_respuestas = "SELECT respuesta,cod_respuesta FROM db_listado_test_respuestas WHERE cod_pregunta = $cod_pregunta";
$respuestas = mysql_query($query_respuestas, $conect) or die(mysql_error());
$row_respuestas = mysql_fetch_assoc($respuestas);
$totalrespuestas = mysql_num_rows($respuestas);

if($totalrespuestas>0){
while(list($respuesta,$cod_respuesta)=mysql_fetch_ array($respuestas)){


echo"<tr><td><div align='left'>$respuesta</div></td> </tr>";
}
}

}

}
?>



<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>

<tr>
<td></td>
</tr>
</table>
</div> </td>
</tr>
</table></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<div align="center" class="Estilo11">Copyright &copy; 1995-2004 Grupo sie. Todos los derechos reservados. Pol&iacute;tica de privacidad.</div>
</body>
</html>
<?php
mysql_free_result($respuestas);

mysql_free_result($preguntas);
?>