1
I have a database with 3 tables and I need to know if in table A (for example) the field guy for 0 will fetch data from table B, if for 1 will fetch data from table C.
And I have the following code that was already on the site (when I picked it up), 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);
?>
<tbody aria-live='polite' aria-relevant='all'>";
Your code has syntax error. Do not mix PHP with HTML.– gmsantos
That code is a mess...
– Jorge B.
@Jorgeb. But that’s how I took it..
– Bruno Gibellino
@Brunogibellino what is happening is that the research is not returning anything.
– Jorge B.
You have data on the table
registofederados
?– Jorge B.
@Jorgeb. Yes I have only one datum
– Bruno Gibellino
with
classe = 1
?– Jorge B.
@Jorgeb. Yes all that is federated is class 1
– Bruno Gibellino
but you have some record with
classe = 1
at the bank?– Jorge B.
In all
mysqli_query()
before the point and comma, add,die(mysqli_error($con));
– rray