```
$sqlCommand2 = "SELECT blogid FROM blogtags WHERE tag='$pageid'";
$query2 = mysqli_query($myConnection, $sqlCommand2) or die (mysqli_error());
while ($row = mysqli_fetch_array($query2)) {
    $selectedtag = $row['blogid'];
}   

```

This sql select should give $selectedtag the value of 1,2,3 but it is only giving the value of 3. The last row that is equal to pageid. Can anyone figure out why it is not pulling all of the rows and only the last one?