mausie Posted November 3, 2006 Share Posted November 3, 2006 Hi,I'm working a page that generates data format so Exel .csv can read it.This is a last part of my code:[code]$ids = array('rechtvak', 'rechtadv', 'opgebcomp', 'opgebflex', 'vakantie', 'adv', 'compverlof', 'flextijd', 'berekend', 'gewerkt','dienstreis', 'thuiswerk', 'feestdag', 'cursus', 'varen', 'werktijdaanboord', 'bv', 'calverlof', 'studieverlof', 'ouderschapsverlof', 'zorgverlof', 'dokter', 'ziek', 'zwangerschapsverlof', 'tijdvoortijd', 'voorwerk', 'nawerk', 'meerwerk'); print 'Datum,';foreach ($ids as $id) {print $id.','; }print '<br />';foreach (array_keys($array) as $arr) { print $arr.','; foreach ($ids as $id){ if(!$array[$arr][$id]) print ','; else { if ($_GET['notation'] == minutes) print $array[$arr][$id].','; else print tohours($array[$arr][$id]).','; } }print '<br />'; } } ?>[/code]You probably don't get it. But that's not importand.This is the output:[code]<name>, <lastname>,,,,,,,,,,,,,,,,,,,,,,,,,,,2005,,,,,,,,,,,,,,,,,,,,,,,,,,,,Datum,rechtvak,rechtadv,opgebcomp,opgebflex,vakantie,adv,compverlof,flextijd,berekend,gewerkt,dienstreis,thuiswerk,feestdag,cursus,varen,werktijdaanboord,bv,calverlof,studieverlof,ouderschapsverlof,zorgverlof,dokter,ziek,zwangerschapsverlof,tijdvoortijd,voorwerk,nawerk,meerwerk02/01/05,338:00:00,,,,,,,,,,,,,,,,,,,,,,,,,,,03/01/05,,,,,,,,,08:47,08:47,,,,,,,,,,,,,,,,,,04/01/05,,,,,,,,,08:48,08:48,,,,,,,,,,,,,,,,,,05/01/05,,,,,,,,,09:03,09:03,,,,,,,,,,,,,,,,,,06/01/05,,,,,,,,,09:15,09:15,,,,,,,,,,,,,,,,,,00:1107/01/05,,,,,,,,,08:36,08:36,,,,,,,,,,,,,,,,,,10/01/05,,,,,,,,,07:12,07:12,,,,,,,,,,,,,,,,,00:04,11/01/05,,,,,,,,,08:12,08:12,,,,,,,,,,,,,,,,,,12/01/05,,,,,,,,,03:25,03:25,,,,,,,,,,,,,,,,,,13/01/05,,,,,,,,,08:01,08:01,,,,,,,,,,,,,,,,,,14/01/05,,,,,,,,,06:58,06:58,,,,,,,,,,,,,,,,,,17/01/05,,,,,,,,,08:33,08:33,,,,,,,,,,,,,,,,,,18/01/05,,,,,,,,,09:02,09:02,,,,,,,,,,,,,,,,,,19/01/05,,,,,,,,,08:57,08:57,,,,,,,,,,,,,,,,,,20/01/05,,,,,,,,,09:15,,09:15,,,,,,,,,,,,,,,,,21/01/05,,,,,,,,,07:53,07:53,,,,,,,,,,,,,,,,,,22/01/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,00:4024/01/05,,,,,,,,,01:05,01:05,,,,,,,,,,,,,,,,,,25/01/05,,,,,,,,,06:53,06:53,,,,,,,,,,,,,,,,,,26/01/05,,,,,,,,,07:30,07:30,,,,,,,,,,,,,,,,,,27/01/05,,,,,,,,,08:10,08:10,,,,,,,,,,,,,,,,,,28/01/05,,,,,,,,,07:36,07:36,,,,,,,,,,,,,,,,,,29/01/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,00:1330/01/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,00:0831/01/05,,,,,,,,,07:34,07:34,,,,,,,,,,,,,,,,,00:03,01/02/05,,,,,,,,,08:37,08:37,,,,,,,,,,,,,,,,,,02/02/05,,,,,,,,,08:29,08:29,,,,,,,,,,,,,,,,,,03/02/05,,,,,,,,,07:33,07:33,,,,,,,,,,,,,,,,,,04/02/05,,,,,,,,,08:09,08:09,,,,,,,,,,,,,,,,,,08/02/05,,,,,,,,,09:55,01:55,08:00,,,,,,,,,,,,,,,,,09/02/05,,,,,,,,,08:10,08:10,,,,,,,,,,,,,,,,,,10/02/05,,,,,,,,,07:57,07:57,,,,,,,,,,,,,,,,,,11/02/05,,,,,,,,,08:49,08:49,,,,,,,,,,,,,,,,,,12/02/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,00:0514/02/05,,,,,,,,,08:34,08:34,,,,,,,,,,,,,,,,,,15/02/05,,,,,,,,,08:49,08:49,,,,,,,,,,,,,,,,,,16/02/05,,,,,,,,,06:13,06:13,,,,,,,,,,,,,,,,,,17/02/05,,,,,,,,,08:03,08:03,,,,,,,,,,,,,,,,,,18/02/05,,,,,,,,,08:02,08:02,,,,,,,,,,,,,,,,,,21/02/05,,,,,,,,,08:02,08:02,,,,,,,,,,,,,,,,,,22/02/05,,,,,,,,,08:43,08:43,,,,,,,,,,,,,,,,,,23/02/05,,,,,,,,,09:02,09:02,,,,,,,,,,,,,,,,,,24/02/05,,,,,,,,,08:50,08:50,,,,,,,,,,,,,,,,,,25/02/05,,,,,,,,,08:40,08:40,,,,,,,,,,,,,,,,,,28/02/05,,,,,,,,,08:57,08:57,,,,,,,,,,,,,,,,,00:03,21/03/05,,,,,,,,,08:29,08:29,,,,,,,,,,,,,,,,,,22/03/05,,,,,,,,,08:45,08:45,,,,,,,,,,,,,,,,,,23/03/05,,,,,,,,,07:35,07:35,,,,,,,,,,,,,,,,,,24/03/05,,,,,,,,,09:02,09:02,,,,,,,,,,,,,,,,,,25/03/05,,,,,,,,,08:00,,,,08:00,,,,,,,,,,,,,,,28/03/05,,,,,,,,,08:00,00:04,,,07:56,,,,,,,,,,,,,,,29/03/05,,,,,,,,,07:58,07:58,,,,,,,,,,,,,,,,,,30/03/05,,,,,,,,,08:23,08:23,,,,,,,,,,,,,,,,,,01/04/05,,,,,,,,,07:22,07:22,,,,,,,,,,,,,,,,,,04/04/05,,,,,,,,,07:57,07:57,,,,,,,,,,,,,,,,,,05/04/05,,,,,,,,,08:05,08:05,,,,,,,,,,,,,,,,,,06/04/05,,,,,,,,,07:53,07:53,,,,,,,,,,,,,,,,,,07/04/05,,,,,,,,,09:02,09:02,,,,,,,,,,,,,,,,,,08/04/05,,,,,,,,,07:45,07:45,,,,,,,,,,,,,,,,,,10/04/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,00:1311/04/05,,,,,,,,,08:06,08:06,,,,,,,,,,,,,,,,,,12/04/05,,,,,,,,,07:48,07:48,,,,,,,,,,,,,,,,,,13/04/05,,,,,,,,,08:00,03:58,,02:00,,,,,,02:02,,,,,,,,,,14/04/05,,,,,,,,,03:53,03:53,,,,,,,,,,,,,,,,,,15/04/05,,,,,,,,,06:40,06:40,,,,,,,,,,,,,,,,,,18/04/05,,,,,,,,,05:19,05:19,,,,,,,,,,,,,,,,,,19/04/05,,,,,,,,,07:06,07:06,,,,,,,,,,,,,,,,,,20/04/05,,,,,,,,,08:20,08:20,,,,,,,,,,,,,,,,,,21/04/05,,,,,,,,,08:06,08:06,,,,,,,,,,,,,,,,,,22/04/05,,,,,,,,,07:07,07:07,,,,,,,,,,,,,,,,,,25/04/05,,,,,,,,,07:23,07:23,,,,,,,,,,,,,,,,,,26/04/05,,,,,,,,,07:41,07:41,,,,,,,,,,,,,,,,,,27/04/05,,,,,,,,,08:27,08:27,,,,,,,,,,,,,,,,,,29/04/05,,,,,,,,,07:59,07:59,,,,,,,,,,,,,,,,,,01/05/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,00:0902/05/05,,,,,,,,,08:00,,08:00,,,,,,,,,,,,,,,,,03/05/05,,,,,,,,,09:09,09:09,,,,,,,,,,,,,,,,,,04/05/05,,,,,,,,,08:40,08:40,,,,,,,,,,,,,,,,,,05/05/05,,,,,,,,,08:00,,,,08:00,,,,,,,,,,,,,,,07/05/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,00:4009/05/05,,,,,,,,,05:48,05:48,,,,,,,,,,,,,,,,,,10/05/05,,,,,,,,,00:32,00:32,,,,,,,,,,,,,,,,,,11/05/05,,,,,,,,,08:25,08:25,,,,,,,,,,,,,,,,,,12/05/05,,,,,,,,,08:25,08:25,,,,,,,,,,,,,,,,,,13/05/05,,,,,,,,,04:54,04:54,,,,,,,,,,,,,,,,,,16/05/05,,,,,,,,,08:00,,,,08:00,,,,,,,,,,,,,,,17/05/05,,,,,,,,,07:40,07:40,,,,,,,,,,,,,,,,,,18/05/05,,,,,,,,,08:21,08:21,,,,,,,,,,,,,,,,,,19/05/05,,,,,,,,,07:58,07:58,,,,,,,,,,,,,,,,,,20/05/05,,,,,,,,,08:29,08:29,,,,,,,,,,,,,,,,,,21/05/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,00:4723/05/05,,,,,,,,,07:07,07:07,,,,,,,,,,,,,,,,,,24/05/05,,,,,,,,,08:01,08:01,,,,,,,,,,,,,,,,,,25/05/05,,,,,,,,,08:04,08:04,,,,,,,,,,,,,,,,,,26/05/05,,,,,,,,,08:15,08:15,,,,,,,,,,,,,,,,,,27/05/05,,,,,,,,,04:16,04:16,,,,,,,,,,,,,,,,,,28/05/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,00:1931/05/05,,,,,,,,,07:58,07:58,,,,,,,,,,,,,,,,,,01/06/05,,,,,,,,,08:40,08:40,,,,,,,,,,,,,,,,,,02/06/05,,,,,,,,,08:11,08:11,,,,,,,,,,,,,,,,,,03/06/05,,,,,,,,,08:32,08:32,,,,,,,,,,,,,,,,,,05/06/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,00:1306/06/05,,,,,,,,,08:05,08:05,,,,,,,,,,,,,,,,,,07/06/05,,,,,,,,,08:18,08:18,,,,,,,,,,,,,,,,,,08/06/05,,,,,,,,,08:23,08:23,,,,,,,,,,,,,,,,,,09/06/05,,,,,,,,,08:34,08:34,,,,,,,,,,,,,,,,,,10/06/05,,,,,,,,,08:51,08:51,,,,,,,,,,,,,,,,,,13/06/05,,,,,,,,,05:27,05:27,,,,,,,,,,,,,,,,,,14/06/05,,,,,,,,,08:17,08:17,,,,,,,,,,,,,,,,,,15/06/05,,,,,,,,,08:07,08:07,,,,,,,,,,,,,,,,,,16/06/05,,,,,,,,,07:57,07:57,,,,,,,,,,,,,,,,,00:03,17/06/05,,,,,,,,,07:02,07:02,,,,,,,,,,,,,,,,,,20/06/05,,,,,,,,,08:22,08:22,,,,,,,,,,,,,,,,,,21/06/05,,,,,,,,,08:22,08:22,,,,,,,,,,,,,,,,,,22/06/05,,,,,,,,,08:50,08:50,,,,,,,,,,,,,,,,,,23/06/05,,,,,,,,,08:32,08:32,,,,,,,,,,,,,,,,,,24/06/05,,,,,,,,,08:11,08:11,,,,,,,,,,,,,,,,,,27/06/05,,,,,,,,,06:57,06:57,,,,,,,,,,,,,,,,,,28/06/05,,,,,,,,,08:14,08:14,,,,,,,,,,,,,,,,,,29/06/05,,,,,,,,,08:15,08:15,,,,,,,,,,,,,,,,,,30/06/05,,,,,,,,,09:00,09:00,,,,,,,,,,,,,,,,,00:08,01/07/05,,,,,,,,,11:21,11:21,,,,,,,,,,,,,,,,,01:54,01:0202/07/05,,,,,,,,,12:33,12:33,,,,,,,,,,,,,,,,,,12:3303/07/05,,,,,,,,,08:22,08:22,,,,,,,,,,,,,,,,,,08:2204/07/05,,,,,,,,,09:34,09:34,,,,,,,,,,,,,,,,,,05/07/05,,,,,,,,,09:14,09:14,,,,,,,,,,,,,,,,,,06/07/05,,,,,,,,,09:14,09:14,,,,,,,,,,,,,,,,,,07/07/05,,,,,,,,,08:56,08:56,,,,,,,,,,,,,,,,,,08/07/05,,,,,,,,,06:16,06:16,,,,,,,,,,,,,,,,,,10/07/05,,,,,,,,,04:26,04:26,,,,,,,,,,,,,,,,,,04:2611/07/05,,,,,,,,,08:45,08:45,,,,,,,,,,,,,,,,,,12/07/05,,,,,,,,,08:57,08:57,,,,,,,,,,,,,,,,,,13/07/05,,,,,,,,,06:56,06:56,,,,,,,,,,,,,,,,00:04,,14/07/05,,,,,,,,,09:15,09:15,,,,,,,,,,,,,,,,,,00:1115/07/05,,,,,,,,,08:42,08:42,,,,,,,,,,,,,,,,,,18/07/05,,,,,,,,,08:16,08:16,,,,,,,,,,,,,,,,,,19/07/05,,,,,,,,,08:27,08:27,,,,,,,,,,,,,,,,00:02,,20/07/05,,,,,,,,,08:59,08:59,,,,,,,,,,,,,,,,,,21/07/05,,,,,,,,,09:15,09:15,,,,,,,,,,,,,,,,00:06,,00:1622/07/05,,,,,,,,,07:43,07:43,,,,,,,,,,,,,,,,,,25/07/05,,,,,,,,,06:17,06:17,,,,,,,,,,,,,,,,,,26/07/05,,,,,,,,,08:51,08:51,,,,,,,,,,,,,,,,,,27/07/05,,,,,,,,,05:43,05:43,,,,,,,,,,,,,,,,,,28/07/05,,,,,,,,,05:55,05:55,,,,,,,,,,,,,,,,,,01/08/05,,,,,,,,,07:55,07:55,,,,,,,,,,,,,,,,,,02/08/05,,,,,,,,,08:38,08:38,,,,,,,,,,,,,,,,,,03/08/05,,,,,,,,,08:51,08:51,,,,,,,,,,,,,,,,,,04/08/05,,,,,,,,,,,,,,,,,,,,,,,,,,,00:06,05/08/05,,,,,,,,,06:33,06:33,,,,,,,,,,,,,,,,,,08/08/05,,,,,,,,,08:55,08:55,,,,,,,,,,,,,,,,00:03,,09/08/05,,,,,,,,,07:10,07:10,,,,,,,,,,,,,,,,,,10/08/05,,,,,,,,,07:27,04:34,,02:53,,,,,,,,,,,,,,,,11/08/05,,,,,,,,,07:35,03:02,,04:33,,,,,,,,,,,,,,,,12/08/05,,,,,,,,,09:15,09:15,,,,,,,,,,,,,,,,,,00:1115/08/05,,,,,,,,,07:14,07:14,,,,,,,,,,,,,,,,,,16/08/05,,,,,,,,,08:46,08:46,,,,,,,,,,,,,,,,,,17/08/05,,,,,,,,,07:41,07:41,,,,,,,,,,,,,,,,,,18/08/05,,,,,,,,,06:47,06:47,,,,,,,,,,,,,,,,,,19/08/05,,,,,,,,,06:06,06:06,,,,,,,,,,,,,,,,,,26/08/05,,,,,,,,,05:45,05:45,,,,,,,,,,,,,,,,,,27/08/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,00:0431/08/05,,,,,,,,,08:24,08:24,,,,,,,,,,,,,,,,,,01/09/05,,,,,,,,,07:14,07:14,,,,,,,,,,,,,,,,,,02/09/05,,,,,,,,,06:39,06:39,,,,,,,,,,,,,,,,,,04/09/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,01:0005/09/05,,,,,,,,,08:16,08:16,,,,,,,,,,,,,,,,,,06/09/05,,,,,,,,,08:17,08:17,,,,,,,,,,,,,,,,,,07/09/05,,,,,,,,,06:50,06:50,,,,,,,,,,,,,,,,,00:03,08/09/05,,,,,,,,,06:33,06:33,,,,,,,,,,,,,,,,,,09/09/05,,,,,,,,,06:51,06:51,,,,,,,,,,,,,,,,,,12/09/05,,,,,,,,,06:52,06:52,,,,,,,,,,,,,,,,,,13/09/05,,,,,,,,,07:07,07:07,,,,,,,,,,,,,,,,,,14/09/05,,,,,,,,,06:40,06:40,,,,,,,,,,,,,,,,,,15/09/05,,,,,,,,,06:48,06:48,,,,,,,,,,,,,,,,,,16/09/05,,,,,,,,,04:23,04:23,,,,,,,,,,,,,,,,,,19/09/05,,,,,,,,,06:36,06:36,,,,,,,,,,,,,,,,,,20/09/05,,,,,,,,,05:10,05:10,,,,,,,,,,,,,,,,,,21/09/05,,,,,,,,,05:19,05:19,,,,,,,,,,,,,,,,,,22/09/05,,,,,,,,,05:53,05:53,,,,,,,,,,,,,,,,,,23/09/05,,,,,,,,,07:54,07:54,,,,,,,,,,,,,,,,,,25/09/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,00:3326/09/05,,,,,,,,,06:51,06:51,,,,,,,,,,,,,,,,,,27/09/05,,,,,,,,,07:18,07:18,,,,,,,,,,,,,,,,,,28/09/05,,,,,,,,,06:42,06:42,,,,,,,,,,,,,,,,,,29/09/05,,,,,,,,,04:02,04:02,,,,,,,,,,,,,,,,,,01/10/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,00:0803/10/05,,,,,,,,,07:22,07:22,,,,,,,,,,,,,,,,,,04/10/05,,,,,,,,,07:24,07:24,,,,,,,,,,,,,,,,,,05/10/05,,,,,,,,,06:45,06:45,,,,,,,,,,,,,,,,,,06/10/05,,,,,,,,,06:21,06:21,,,,,,,,,,,,,,,,,,10/10/05,,,,,,,,,07:23,07:23,,,,,,,,,,,,,,,,,,11/10/05,,,,,,,,,09:00,,09:00,,,,,,,,,,,,,,,,,12/10/05,,,,,,,,,04:32,04:32,,,,,,,,,,,,,,,,,,13/10/05,,,,,,,,,08:48,08:48,,,,,,,,,,,,,,,,,,14/10/05,,,,,,,,,03:53,03:53,,,,,,,,,,,,,,,,,,17/10/05,,,,,,,,,07:56,07:56,,,,,,,,,,,,,,,,,,18/10/05,,,,,,,,,07:01,07:01,,,,,,,,,,,,,,,,,,19/10/05,,,,,,,,,04:10,04:10,,,,,,,,,,,,,,,,,,20/10/05,,,,,,,,,07:03,07:03,,,,,,,,,,,,,,,,,,21/10/05,,,,,,,,,07:18,07:18,,,,,,,,,,,,,,,,,,23/10/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,00:1330/10/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,00:1631/10/05,,,,,,,,,07:11,07:11,,,,,,,,,,,,,,,,,,01/11/05,,,,,,,,,07:03,07:03,,,,,,,,,,,,,,,,,,02/11/05,,,,,,,,,05:53,05:53,,,,,,,,,,,,,,,,,,03/11/05,,,,,,,,,06:17,06:17,,,,,,,,,,,,,,,,,,04/11/05,,,,,,,,,08:00,,,,,,,,,,,,,,08:00,,,,,07/11/05,,,,,,,,,05:20,05:20,,,,,,,,,,,,,,,,,,08/11/05,,,,,,,,,06:45,06:45,,,,,,,,,,,,,,,,,,09/11/05,,,,,,,,,06:31,06:31,,,,,,,,,,,,,,,,,,10/11/05,,,,,,,,,08:00,,08:00,,,,,,,,,,,,,,,,,11/11/05,,,,,,,,,04:20,04:20,,,,,,,,,,,,,,,,,,14/11/05,,,,,,,,,08:00,,,,,,,,,,,,,,08:00,,,,,15/11/05,,,,,,,,,08:00,,,,,,,,,,,,,,08:00,,,,,16/11/05,,,,,,,,,08:00,,,,,,,,,,,,,,08:00,,,,,17/11/05,,,,,,,,,08:00,,,,,,,,,,,,,,08:00,,,,,18/11/05,,,,,,,,,08:00,,,,,,,,,,,,,,08:00,,,,,19/11/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,00:5621/11/05,,,,,,,,,08:00,,,,,,,,,,,,,,08:00,,,,,22/11/05,,,,,,,,,08:00,,,,,,,,,,,,,,08:00,,,,,23/11/05,,,,,,,,,08:00,,,,,,,,,,,,,,08:00,,,,00:24,24/11/05,,,,,,,,,08:00,,,,,,,,,,,,,,08:00,,,,,25/11/05,,,,,,,,,08:00,,,,,,,,,,,,,,08:00,,,,,26/11/05,,,,,,,,,,,,,,,,,,,,,,,,,,,,01:0628/11/05,,,,,,,,,08:00,,,,,,,,,,,,,,08:00,,,,,29/11/05,,,,,,,,,08:00,,,,,,,,,,,,,,08:00,,,,00:42,30/11/05,,,,,,,,,08:00,03:14,,,,,,,,,,,,,04:46,,,,,01/12/05,,,,,,,,,08:00,03:18,,,,,,,,,,,,,04:42,,,,,02/12/05,,,,,,,,,08:00,03:15,,,,,,,,,,,,,04:45,,,,00:31,05/12/05,,,,,,,,,08:00,03:56,,,,,,,,,,,,,04:04,,,,,06/12/05,,,,,,,,,08:00,06:10,,,,,,,,,,,,,01:50,,,,,07/12/05,,,,,,,,,08:00,,,,,,,,,,,,,,08:00,,,,,08/12/05,,,,,,,,,08:00,04:36,,,,,,,,,,,,,03:24,,,,,09/12/05,,,,,,,,,08:00,07:06,,,,,,,,,,,,,00:54,,,,,12/12/05,,,,,,,,,08:00,07:47,,,,,,,,,,,,,00:13,,,,,13/12/05,,,,,,,,,08:00,05:55,,,,,,,,,,,,,02:05,,,,,14/12/05,,,,,,,,,08:00,05:22,,,,,,,,,,,,,02:38,,,,,15/12/05,,,,,,,,,08:00,05:49,,,,,,,,,,,,,02:11,,,,,16/12/05,,,,,,,,,08:00,05:19,,,,,,,,,,,,,02:41,,,,,19/12/05,,,,,,,,,08:00,,,,,,,,,,,,,,08:00,,,,,20/12/05,,,,,,,,,08:00,04:05,,,,,,,,,,,,,03:55,,,,,21/12/05,,,,,,,,,08:00,05:45,,,,,,,,,,,,,02:15,,,,,22/12/05,,,,,,,,,08:00,06:33,,,,,,,,,,,,,01:27,,,,,23/12/05,,,,,,,,,08:00,03:46,,,,,,,,,,,,,04:14,,,,,26/12/05,,,,,,,,,08:00,,,,08:00,,,,,,,,,,,,,,,27/12/05,,,,,,,,,,,,,,,,,,,,,,,,,,,05:00,01:1530/12/05,,,,,,,,,03:00,03:00,,,,,,,,,,,,,,,,,,31/12/05,,,,,296:25:00,,,,296:25:00,,,,,,,,,,,,,,,,,,,[/code]This will be a nice table in Exel if you copy/paste it to a file and rename to .csv.Even tho, I want to make a file on the server including this all so it can be downloaded by 1 click.So my question is, how can I get all these data that's being 'printed' on my screen in a var to get it into a fwrite?Hope I get some answers, I'll be back to try it out after the weekend :)Thanks in advance and have a great weekend,Maurice Link to comment https://forums.phpfreaks.com/topic/26053-getting-alot-of-data-into-varable/ Share on other sites More sharing options...
obsidian Posted November 3, 2006 Share Posted November 3, 2006 Maurice, here is a simple way to output everything to a CSV file:[code]<?php$filename = "yourCSVfile.txt";if (is_writable($filename)) { if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; } else { fwrite($handle, "Datum," . implode(',', $ids) . "\n"); foreach ($array as $key => $val) { $out = "$key,"; foreach ($ids as $id) { if (!$val[$id]) $out .= ','; elseif ($_GET['notation'] == 'minutes') $out .= $val[$id] . ','; else $out .= tohours($val[$id]). ','; } $out .= "\n"; fwrite($handle, $out); } }} else { echo "Couldn't write to file!";}?>[/code]Hope this helps. Link to comment https://forums.phpfreaks.com/topic/26053-getting-alot-of-data-into-varable/#findComment-119108 Share on other sites More sharing options...
mausie Posted November 6, 2006 Author Share Posted November 6, 2006 Thanks for the help.Even though I couldn't get your script to work. It made a .csv file but it was a bit messed up.I didn't understand the code either :(So I've searched for a alternative and not really found a method for this but the parameter " .= " .Which I totally forgotten.I've started build something with that in mind and it works :DHere's the code if you're interested:[code]<?php$data = $_GET['names'].',<br />'.$year.'<br /><br />'; $data .= 'Datum,';foreach ($ids as $id) {$data .= $id.','; }$data .= '<br />';foreach (array_keys($array) as $arr) { $data .= $arr.','; foreach ($ids as $id){ if(!$array[$arr][$id]) $data .= ','; else { if ($_GET['notation'] == minutes) $data .= $array[$arr][$id].','; else $data .= tohours($array[$arr][$id]).','; } }$data .= '<br />'; } unlink('sheet.csv');$filename = 'sheet.csv';$fp = fopen($filename,"a"); // $fp is now the file pointer to file $filenameif($fp){ fwrite($fp,str_replace("<br />","\n",$data)); // Write information to the file fclose($fp); // Close the file} else { echo "Cannot create csv file";}?>[/code] Link to comment https://forums.phpfreaks.com/topic/26053-getting-alot-of-data-into-varable/#findComment-120230 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.