Create an array from mySql data

Is it somehow possible to store mySql data in an array without having to use a while loop in php?

I only have 1 column here.

 $members = $conn->prepare(Select id from members where state = 'CA');
    $members->execute();
    //Result ->1, 2, 3, 4, 5, 6, 7, 8, 9
    //$myarray = array of the above results.
    $myarray = array(1, 2, 3, 4, 5, 6, 7, 8, 9)//Has to be this kind of array.

I’m trying to avoid another while loop here, since this thing goes inside some more code.

I think you might be interested in fetchAll with PDO::FETCH_COLUMN

Sometime ago I used fetch_column and things went horribly wrong. But I guess I have no option here but to use this.