Thanks for reading.

I'm trying to learn inner join and join. My aim is to comparing that if the user created the community is also marked as an admin in the CommunityMembers table (I'm not sure if INNER JOIN achieves this) and take all other community information from Community table related to CommunityID (this is possible with inner join as I understand).

I have two tables called Community and CommunityMembers.

the structure is for Community(it has other data such as date, contents etc...):

```
CommunityID -    Slug      - CreatedByUser
     1      -    video     -      2
     2      -    funny     -      2
     3      -    picture   -      4

```

for CommunityMembers

```
 CmID - UserID  -      Slug         - Power
   1  -   2     -      video        - admin
   2  -   2     -      funny        - admin
   3  -   4     -      picture      - admin

```

my php code: ( `$_SESSION['UserID']` is 2 )

```
<?php

$sql = $dbc->prepare(" SELECT cm.*, com.* 
                       FROM Community com
                       INNER JOIN CommunityMembers cm ON cm.UserID = com.CreatedByUser
                       WHERE cm.UserID = '" . $_SESSION['UserID'] . "'");

$sql->execute();

if($sql->rowCount()){
    echo  $sql->rowCount();
    while($data = $sql->fetch()){
        $output .= $data['Slug'] .'<br />';
    }
    echo $output;
}else{
    $_ERROR = "no record";
}
?>

```

`echo $output;` prints 

```
video
video
video
funny
funny
funny

```

and `echo $sql->rowcount();` prints
 6

Could you please help with this? Why is this printing same thing 3 times? and is my solution right to check if is user created the community is marked as admin in the CommunityMembers or do I need to check it?

Thanks.