samedi 16 octobre 2021

PHP - If else condition

I am trying to create an if-else condition in PHP between 2 variables in an array.

PHP Code:

   $todaysData = mysqli_fetch_array($records);

    $tomorrowData = mysqli_fetch_array($records);

    //HTML TABLE WHERE I WANT TO PRINT THE RESULTS
    <div class="u-table u-table-responsive u-table-1">
      <table class="u-table-entity">
        <colgroup>
          <col width="100%">
        </colgroup>
        <tbody class="u-table-body">
          <tr style="height: 118px;">
            <td class="u-align-center u-table-cell u-table-cell-1"><?php echo $todaysData['Fajr Begins']; ?></td>
          </tr>
        </tbody>
      </table>
    </div>
    <div class="u-table u-table-responsive u-table-2">
      <table class="u-table-entity">
        <colgroup>
          <col width="100%">
        </colgroup>
        <tbody class="u-table-body">
          <tr style="height: 118px;">
            <td class="u-align-center u-table-cell u-text-palette-3-base u-table-cell-2"><?php echo $todaysData['Fajr Jamaat']; ?></td>
          </tr>
        </tbody>
      </table>
    </div>
    <div class="u-table u-table-responsive u-table-3">
      <table class="u-table-entity">
        <colgroup>
          <col width="100%">
        </colgroup>
        <tbody class="u-table-body">
          <tr style="height: 72px;">
            <td class="u-align-center u-table-cell u-text-palette-2-base u-table-cell-3"><?php echo $tomorrowData['Fajr Jamaat']; ?></td>
          </tr>
        </tbody>
      </table>
    </div>

The condition: If $tomorrowData['Fajr Jamat'] > $todaysData['Fajr Jamat'] then echo $tomorrowData['Fajr Jamat'] else echo "-"

I want to see this condition value in the html table data : <td class="u-align-center u-table-cell u-text-palette-2-base u-table-cell-3"><?php echo $tomorrowData['Fajr Jamaat']; ?></td>

Aucun commentaire:

Enregistrer un commentaire