I am having trouble with a part of my code. I want the checkbox in the last column to be checked if the corresponding DB value is 1, but something keeps going wrong with my code, anyone who sees what's wrong? It's probably very simple but I can't find it.
<?php
$sql = "SELECT * FROM registered ORDER BY datum";
$myData=mysql_query($sql,$con) ;
?>
<table width="1100" border="1">
<tr>
<th style="text-align:center; padding:0 10px">naam</th>
<th style="text-align:center; padding:0 10px">betaald?</b></th>
</tr>
<?php
$betaald = $record['betaald'];
while($record = mysql_fetch_array($myData)) {
echo "<tr>";
echo "<td>" . $record['naam'] . "</td>";
echo "<td> <input type='checkbox' name='betaald' id='betaald' value='1' ". echo ($betaald==1 ? 'checked' : ''); . " ></td>";
echo "</tr>";
}
mysql_close($con);
?>