Question
Here is the code I have so far ... I just need some help finishing it! Please complete all parts of the question. Thank you
Here is the code I have so far... I just need some help finishing it! Please complete all parts of the question. Thank you :)
Code to Copy and Paste:
/* $csv='John;Lennon'; writeCSV('beatles.csv',$csv); $csv='Paul;McCartney'; writeCSV('beatles.csv',$csv); */ echo '
'; print_r(readCSV('beatles.csv'));function writeCSV($file,$data){ $h=fopen($file,file_exists($file) ? 'a' : 'w+'); fwrite($h,$data. " " /* PHP_EOL */); fclose($h); }
function readCSV($file){ $h=fopen($file,'r'); $output=''; while(!feof($h)) $output.=fgets($h); fclose($h); $output=explode(" ",$output); unset($output[count($output)-1]); for($i=0;$i
/* *read all the records from a CSV file *read the record with index i in the CSV file *modify the record with index i in the CSV file *delete the record with index i from the CSV file */
The task for the assigment is to work on csv.php and complete it with functions that read all the records from a CSV file read the record with index i in the CSV file modify the record with index i in the CSV file delete the record with index i from the CSV file 1 '; print_r(readcsv ('beatles.csv')); function writecsv($file, $data) { $h=fopen($file, file_exists($file) ? 'a': 'w+'); fwrite($h, $data. " " /* PHP_EOL */); fclose($h); } 15 16 18 19 function readcsv ($file) { $h=fopen($file,'r'); $output=''; while(!feof ($h)) $output.=fgets($h); fclose($h); $output=explode(" ",$output); unset($output[count($output)-1]); for($i=0; $i'; print_r(readcsv ('beatles.csv')); function writecsv($file, $data) { $h=fopen($file, file_exists($file) ? 'a': 'w+'); fwrite($h, $data. " " /* PHP_EOL */); fclose($h); } 15 16 18 19 function readcsv ($file) { $h=fopen($file,'r'); $output=''; while(!feof ($h)) $output.=fgets($h); fclose($h); $output=explode(" ",$output); unset($output[count($output)-1]); for($i=0; $i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started