mySql和PHP语法......缺少一些简单的东西

I am almost embarrassed to ask this, but I have been staring at it and feel like there is an easy answer but i'm not seeing/finding it.

I have this line in my php where i am using a string "checked" to check a checkbox.

<input type='checkbox' name='hikeL[]' id=".$row["ID"]." ".$row["Chk"].">

I am trying to convert so that I can make it more powerful.. e.g. use a 1 or 0 to affect multiple things vs just checking the checkbox. I have tried changing it to this, but there is clearly a syntax issue that I haven't been able to resolve.

<input type='checkbox' name='hikeL[]' id=".$row["ID"]." ".$row["Chk"].==1 ? "checked" : "" ">

this is all being echo'd in a greater statement...

while($row = $result->fetch_assoc()) {
echo "<tr class=''>
<td class='hikesElement'>
    <form action='checkbox.php' method='post'>
        <input type='checkbox' name='hikeL[]' id=".$row["ID"]." ".$row["Chk"].">
    </form>
</td>
</tr>";
}

Any thoughts would be great.. kind of new to mySql and php, so much appreciated..

You seem to miss a dot before "> and some brackets:

  <input type='checkbox' name='hikeL[]' id=".$row["ID"]." ".($row["Chk"]==1 ? "checked" : ""). ">

See the line

<input type='checkbox' name='hikeL[]' id=".$row["ID"]." ". {$row["Chk"] == 1 ? "checked" : "" } . ">

your code must be this:

<?php

while($row = $result->fetch_assoc()) {
echo "<tr class=''>
<td class='hikesElement'>
    <form action='checkbox.php' method='post'>
        <input type='checkbox' name='hikeL[]' id=".$row["ID"]." ". {$row["Chk"] == 1 ? "checked" : "" } . ">
    </form>
</td>
</tr>";
}

First you don't have ID in any type of quotations.

also i'm assuming the $row["Chk"] value should be equalt to nothing if not checked or checked="checked" if you want it checked.

<input name="checkbox" type="checkbox" id="checkbox" checked="checked" />