I have extracted all the domains I have from my database, I would like to draw all comments to the domains that are added in the database.

```
$results = $mysqli->query("SELECT domain_name, id_view FROM domain GROUP BY domain_name ORDER BY domain_name");
$comment = $mysqli->query("SELECT domain_name, id_view, comment FROM domain_comment");
$id_array = array();
while($row = mysqli_fetch_array($comment)) {
    $id_array[] = $row['comment'];
    $id_array[] = $row['id_view'];
}

while($row = mysqli_fetch_array($results))
{

    $section = $row['id_view'];
          foreach ($id_array as $sectionname) {
            if ($sectionname == $section) {
                echo $sectionname;
            }
          }
}

```

The data it receives is VIEW ID and not Comment, what am I doing wrong?

EDIT:
When he gives the Select query:

```
$comment = $mysqli->query("SELECT comment FROM domain_comment INNER JOIN domain ON domain_comment.id_view = domain.id_view");

```

while($row = mysqli\_fetch\_array($results))
{

```
while($row2 = mysqli_fetch_array($comment))
        {
          echo $row2['comment'];
        }

```

}

It prints all the comments at the first domain.

The result I have:
![The result I have](https://i.stack.imgur.com/VLNCm.png)

The result he wants:
![The result he wants](https://i.stack.imgur.com/WJLdM.png)