Generate an associative array from an array of rows using one column as keys and another column as values October 1, 2022 by Tarik Why not just use $dataarray[$row['id']] = $row['data']; ?