If else in a table cell

I have a table with a row called weeknumber (int 11) If anyone fills out the week number for example if they input 1 then it shows as 1 if they dont fill out the input then it returns as 0

In my html table inside a cell i am trying to show whether this row has been filled out or not. For example if someone inputted 1 in the weeknumber then i want to show it as a tick but if no entry was made it returns as 0 and show it as a cross.

i cant get it to work and here is what i am using:

<td><?php if ($row['weeknumber'] == "0")
      { echo "<img src='/notick.jpg'>"; }
      else{ echo "<img src='/yestick.jpg'>"; }?></td>

Thanks

Get all that code out of the table for starters.

<?php
$imageSrc = $row['weeknumber'] == 0 ? '/notick.jpg' : '/yestick.jpg';
?>
<td><img src="<?= $imageSrc ?>"></td>
Sponsor our Newsletter | Privacy Policy | Terms of Service