如何回显动态复选框?

I have problems displaying my checkboxes. Can anyone please help? I search the solution online and I tried the codes but it doesn't work.

Here is my codes

<?php
include "mysqli.connect.php";
// Make a MySQL Connection
$retrieveflavor = "SELECT * FROM flavor"; 
$result = $mysqli->query($retrieveflavor);  
while ($row = $result->fetch_array(MYSQLI_ASSOC))
{
    //echo "<input type='checkbox' name='candyFlavors[]' value=".$row['flavorname']."/>";
    //echo "<input type=\"checkbox\" name=\"candyFlavors[]\" value=\"$row[flavorname]\">";
    //echo "<input name=\"candyFlavors[]\" type='checkbox' value='"$row[flavorname]"'/>";
    echo "<td><img src=".$row['image']." width='240px' height='190px'></td>";
    echo "<input type=\"checkbox\" name=\"candyFlavors[]\" value=\"$row[flavorname]\">";
}
?>

I think it should be like this.

echo "<input type=\"checkbox\" name=\"candyFlavors[]\" value=\"".$row['flavorname']."\">";

You missed single quote in $row[flavorname]

  echo '<input type="checkbox" name="candyFlavors[]" value="'.$row['flavorname'].'">';

Try this