we have a problem with our loop cause when we use an if statement it only shows one of our titles and not all of them

this is our code:

```
$sqldayshours = mysqli_query($link, "SELECT *  FROM event;") or die("Kon de comments niet ophalen");
$event_time = mysqli_fetch_assoc($sqldayshours);

$title =  $event_time['event_title'];
    $day = $event_time['event_date_day'];
    $uur = $event_time['event_date_hour'];
    $ide = $event_time['event_id'];
    $idsql="day".$day."uur".$uur;

for($rij=8;$rij<19;$rij++)
    {
        echo " < tr > ";
                    for($i=0;$i<8;$i++)
            {
                    $id = "day".$i."uur".$rij;
                    echo " < td id=\"$id\" name=\"$id\" class=\"events\">";
                    if($i==0){
              echo $rij.":00 ";
                  }else{ 
                                    if($idsql == $id ){ 
                                   echo $title; 
                               }
                }
        echo "< /td >";
                }`

        echo "< /tr >";

    }

```