<?php
function    myQuery($query,$fields){
    include('dbConnection.php');
    $q = $query;
    $r = mysqli_query($db_connection, $q);
    
    $dat = array();
    while($row = mysqli_fetch_assoc($r)){
        $id = $row['id'];
        foreach($fields as $col){
            $dat[$id][$col] = $row[$col];
        }
    }
    return $dat;
}
//Usage and syntax example
//include('myQuery.php');
//$user = $_COOKIE['user'];
//$data = myQuery("select * from subscriber where id='$user'",['spinner']);
//echo $data[$user]['spinner'];
//
// MyQuery("query",[array of values in CSV]);
// This function returns a 3d array keyed off the user id
?>