I am Sharam, current exchange student in Europe from a after school club tackling politics & issues concerning the youth of Southeastern Asia. In our group we have new volunteers around the world every month and we have setup central server to categorise & prioritise tasks the club must have performed in the future to have meaning in our country. I have little knowledge in PHP however I am eager to learn, here is my problem...
Because SQL it's too complex we use CSV. Everybody can edit master CSV & add tasks to it like here:
Priority,Task,Person
High,Campus flyers,Ashley
High,Test videocall with teacher,Sharam
Low,New Website,Martin & Aneet
Medium,Auditorium recruiting,Martin & Aneet & Ashley
Low,Garbage collecting,Sharam & Ashley
High,Ask permission to reserve classroom Sat & Sun,Sharam
As you see, priority of item is high, medium, low in any order. I tried array_merge_recursive() but maybe I am doing it wrong:
<?php
$file = @fopen("tasks-list.csv", "r") or exit("error, check server status");
$array = array();
$header = fgetcsv($file, 1000, ","); //don't need header in array
while (!feof($file)) {
$data = fgetcsv($file, 1000, ",");
if (!empty($data)) {
$array = array_merge_recursive($array, array($data[0] => $data[1], $data[2]));
}
}
fclose($file);
?>
Result is mixed up and I am missing how to make CSV input grouped by column like here:
High priority tasks:
1. Campus flyers (Ashley)
2. Test videocall with teacher (Sharam)
3. Ask permission to reserve classroom Sat & Sun (Sharam)
Medium priority tasks:
1. Auditorium recruiting (Martin & Aneet & Ashley)
Low priority tasks:
1. New Website (Martin & Aneet)
2. Garbage collecting (Sharam & Ashley)
My code it's missing presentational part but it is not the difficult part. HTML is easy to me but I have problem with array grouped properly. How can I achieve it? Thank you
Sorry about my grammars & spelling, I am just learning second year of English! --Sharam