I'm trying to print some results from a query, showing whether a user is a member or not. I am trying to place an IF statement within the loop, so that if the user is a Member (Member = 1), then the checkbox will be selected when the page loads, showing that the user is a member. Basically if they are a member, then "checked" is added to the input html so that the check box has a check mark in it when the page loads.
I keep getting this error:
"Parse error: syntax error, unexpected T_IF in /home/content/result.php on line 63 "
I am having trouble figuring out why my IF statement isn't working.. is it just syntax or is it not possible to have it here within the loop? Racking my brains here, I bet it's a simple answer but need help from my SO community. Thank you.
while ($results = $query->fetch()) {
echo '<tr>',
'<td class="text-left"><input type="checkbox" name="member"',
if($results['Member'] == '1') {echo "checked";},'></td>',
'</tr>'
;