I have a database with 3 tables and I need to know if in table A (for example) the field type is 0 it will fetch data from table B, if it is 1 it fetches data to table C.
And I have the following code that came in the site (when I got it), and gives error:
Warning: mysqli_fetch_array () expects parameter 1 to be mysqli_result, boolean given
<?php
include("connection.php");
mysqli_set_charset($con,"utf8");
<tbody aria-live='polite' aria-relevant='all'>";
$result3 = mysqli_query($con,"SELECT lugar,dorsal as id,tipo as classe from classificacao where tipo2=70");
while($row3 = mysqli_fetch_array($result3)){
if($row3['classe'] == 0){
$result8 = mysqli_query($con,"SELECT r.nome, r.equipa from registo r where id=r.Dorsal and classe = 0");
while($row4 = mysqli_fetch_array($result8)){
echo "<tr>";
echo "<td>" . $row3['lugar'] . "</td>";
echo "<td>" . $row3['id'] . "</td>";
echo "<td>" . $row4['nome'] . "</td>";
echo "<td>-</td>";
echo "<td>" . $row4['equipa'] . "</td>";
echo "</tr>";
}
}
else{
$result9 = mysqli_query($con,"SELECT f.nome, f.n_federado, f.equipa from registofederados f where id=f.Dorsal and classe = 1");
while($row5 = mysqli_fetch_array($result9)){//linha 345
echo "<tr>";
echo "<td>" . $row3['lugar'] . "</td>";
echo "<td>" . $row3['id'] . "</td>";
echo "<td>" . $row5['nome'] . "</td>";
echo "<td>" . $row5['n_federado'] . "</td>";
echo "<td>" . $row5['equipa'] . "</td>";
echo "</tr>";
}
}
}
echo "</tbody>
</table>
</div>";
mysqli_close($con);
?>