PHP in_array function with mysqli

The following code will grab rows from a table and add the to the $members array. During each loo, the in_array() function checks and makes sure the value from the 'id' column is not a duplicate. The 'continue;' will restart the loop if a duplicate exists.

This is just a demo. In reality, the 'id' field would be a primary key and autoincrement, thus, the array would be unique anyhow.

$db = public_db_connect();
$members = array();
$command = "SELECT * FROM table_sort WHERE id > 0";
$result = mysqli_query($db, $command);

while ($row = mysqli_fetch_assoc($result)) {
    $memberID = $row['id'];
    $first_name = $row['firstname'];
    $last_name = $row['lastname'];
//echo $memberID;

    if(in_array($row['id'], $members)){continue;}
    $members[] = $memberID.",".$first_name.",".$last_name;