When I click on the update button, the SQL query updates the last record not the wanted one

when displaying several courses, I would like to give the user the right to confirm one of the courses, when I click on the update button, it updates the last record

```
<?php
$cc = mysqli_query($mysqli, "SELECT * from course WHERE c_email ='$emailu' AND course_situation='pending'");
while($ccc = mysqli_fetch_array($cc)) {
    $idcourse = $ccc['idcourse'];
    $city = $ccc['idville'];
    $pickup = $ccc['course_depart'];
    ?>
    <tr>
        <td><?= $idcourse ?></td>
        <td><?= $pickup ?></td>
        <td><?php echo $ccc['course_date'] ?>, <?php echo
            $ccc['course_heure'] ?></td>
        <td>
            <?php
            if($ccc['course_situation'] == "pending") { ?>
                <span class="badge badge-danger">Pending</span>
            <?php } else { ?>
                <span class="badge badge-success">Confirmed</span>
            <?php } ?>
        </td>
        <td><?php echo $ccc['c_phone'] ?></td>
        <td><?php echo $ccc['c_phone'] ?></td>
        <td><?php echo $ccc['idclient'] ?></td>
        <td>
            <button type="submit" name="cancelcourse" class="btn btn-danger btn-xs"><i class="icon md-check" aria-hidden="true"></i> Update</button>
    </tr>
<?php }

if(isset($_POST["cancelcourse"])) {
    $query = "UPDATE course SET id='$idu' AND course_situation='confirmed' WHERE idcourse='$idcourse' ";

    if(mysqli_query($mysqli, $query)) {
        echo "<div class='  alert alert-success' style='padding-left:150px'>
<strong>Success!</strong> Event page updated.</a>.
</div>";
        echo '<META HTTP-EQUIV="Refresh" Content="0; URL=index.php">';
    } else {
        echo "<div class='alert alert-danger'>
<strong>ERROR!</strong> We invite you to try Again Later.
</div> " . mysqli_error($mysqli);
    }
}

```