ERROR:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\web\test_clase.php on line 37
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\web\test_clase.php on line 72
PROGRAMA
Código PHP:
Ver original
<?php include('include/opendbase.php'); // ----------------------- LEE CLASES -------------------------------------- $consulta = "SELECT * FROM `clases` WHERE clase = '$clase' "; $Id_TipoC = $row['idTC']; // ---------------------- LEE TEST ----------------------------------------- $consulta = "SELECT * FROM `tests` WHERE Id_TipoC = '$Id_TipoC' AND CodiTest = '$testNumero' "; $IdTest = $row['Id']; $NumRespostes = $row['NumRespostes']; /// ---------------------- LEE Preguntas ------------------------------------- $consulta = "SELECT * FROM tests_preguntes, preguntes WHERE tests_preguntes.Id_Test = $IdTest AND tests_preguntes.Id_Pregunta = Preguntes.Id ORDER BY Posicio"; // echo $consulta.'<br>'; $indAux = 1; $id = $indAux; // $row['id']; $pregunta[$id]['id'] = $id; $pregunta[$id]['Posicio'] = $row['Posicio']; $pregunta[$id]['Pregunta'] = $row['Pregunta']; $pregunta[$id]['Resp1'] = $row['Resp1']; $pregunta[$id]['Resp2'] = $row['Resp2']; $pregunta[$id]['Resp3'] = $row['Resp3']; $pregunta[$id]['Resp4'] = $row['Resp4']; $pregunta[$id]['RespCorrecta'] = $row['RespCorrecta']; $pregunta[$id]['FotoPreg'] = $row['FotoPreg']; $indAux++; } echo '<input type="hidden" id="preguntaActual" value="1" />'; $titulo = 'Test Nro '.$testNumero; echo '<div class="btnVarios" >'; echo '<h2 style="color:#009900;" >'.$titulo.'</h2>'; echo '</div>'; echo '<hr class="oculto" />'; if ($mostrarTest == 1) { $_SESSION['numero'] = $testNumero; $_SESSION['clase'] = $clase; $auxPreg = 0; echo '<form name="formTest" method="post" action="evaluacion_test.html" >'; echo '<input type="hidden" name="evaluar" value="1" />'; foreach($pregunta as $pregId => $fila) { if ($pregId == 1) { $display = 'block'; } else { $display = 'none'; }