vendredi 8 janvier 2016

If else inside my echo inside

How can I add if-else statement inside my echo tr and td? I try this code below but my output is a blank page.

 <?php
$stmt = $dbh->prepare("$query");
$stmt->execute();
$result = $stmt->fetchAll();
$i="0";
$ext = EXT;
if ($stmt->rowCount() > 0) {
foreach($result as $value) {
            $i++;

        $id = $value['id'];
    $gccode = $value['gccode'];
    $datecreated = $value['datecreated'];
    $notes= $value['notes'];
            $branch = $value['branch'];
    $groupid = $value['groupid'];
    $status = $value['status'];


    echo "<tr  class=\"gradeA\">

      <td>$i</td>
      <td>$id</td>
      <td>$gccode</td>
      <td>$datecreated</td>
      <td>$notes</td>
      <td>$branch</td>
      <td>"if ($value['groupid']=="1"){ echo  'Regular';}
      else { echo  'Complimentary'; } "</td>
          <td>$status</td>
      </tr>";
}
}

Thank Your for the help guys!

Aucun commentaire:

Enregistrer un commentaire