Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean g


#1

Hi,
Really struggling to find out why it’s throwing this error. Any idea’s?

[code] <?php
$card = “SELECT * FROM fights WHERE event_id = $id”;
$result = mysqli_query($connection, $card);

    while($row = mysqli_fetch_assoc($result)) {

    $fighter1 = $row['fighter1'];   
    $fighter2 = $row['fighter2'];   
    $winner = $row['winner'];
    $loser = $row['loser'];
    $method = $row['method'];
    $scorecard = $row['scorecard'];

?>


<?php echo $winner ?> DEF. <?php echo $loser ?> VIA <?php echo $method ?> (<?php echo $scorecard ?>)
<?php } ?> [/code]

Code starts at line 111.

Thanks


#2

The biggest help I can give, is use prepared statements. The query is failing, hence the “boolean given” message.