I'm busy making a small comment system. I want users to be able to give ratings, besides giving comments, and right now i'm storing these rating values (that come from radio buttons) in the database. However, when I try to populate radio buttons with rating values for each comment from the database, the following script only checks the radio button that corresponds to the last value in the database.

```
    <?php 
$sql = mysql_query("SELECT * FROM comments WHERE id_post = '$id_post'") or die(mysql_error());;
while($affcom = mysql_fetch_assoc($sql)){ 
    $name = $affcom['name'];
    $email = $affcom['email'];
    $comment = $affcom['comment'];
    $rating = $affcom['rating'];
    $date = $affcom['date'];

    // Get gravatar Image 
    // https://fr.gravatar.com/site/implement/images/php/
    $default = "mm";
    $size = 35;
    $grav_url = "http://www.gravatar.com/avatar/".md5(strtolower(trim($email)))."?d=".$default."&s=".$size;

?>
<div class="cmt-cnt">
    <img src="<?php echo $grav_url; ?>" />
    <div class="thecom">
        <h5><?php echo $name; ?></h5><span data-utime="1371248446" class="com-dt"><?php echo $date; ?></span>
        <br/>
        <p>
            <?php echo $comment; ?>
        </p>
        <p>

           <input type="radio" name="hoi" value="1" <?php echo ($rating=='1')?'checked':'' ?> />
           <input type="radio" name="hoi" value="2" <?php echo ($rating=='2')?'checked':'' ?> />
           <input type="radio" name="hoi" value="3" <?php echo ($rating=='3')?'checked':'' ?> />
           <input type="radio" name="hoi" value="4" <?php echo ($rating=='4')?'checked':'' ?> />
           <input type="radio" name="hoi" value="5" <?php echo ($rating=='5')?'checked':'' ?> />

        </p>
    </div>
</div><!-- end "cmt-cnt" -->
<?php } ?>

```

This is an image of what it looks like right now:

[![enter image description here](https://i.stack.imgur.com/Oz54x.png)](https://i.stack.imgur.com/Oz54x.png)

Can someone tell me how to check all of the boxes (based on database values)?