I have a CSV file which the code below uses to put the contents of the CSV into a multidimensional array.
<?php
$val = $_GET['articleid'];
//URL Pass STring
$arrCSV = array();
// Open the CSV
if (($handle = fopen("../articles/artlist.csv", "r")) !==FALSE) {
// Set the parent array key to 0
$key = 0;
// While there is data available loop through unlimited times (0) using separator (,)
while (($data = fgetcsv($handle, 0, ",")) !==FALSE) {
// Count the total keys in each row
$c = count($data);
//Populate the array
for ($x=0;$x<$c;$x++) {
$arrCSV[$key][$x] = $data[$x];
}
$key++;
} // end while
// Close the CSV file
fclose($handle);
} // end if
?>
My first part is to output the entire array.
I think this code below is wrong :(
<?php
for ( $row = 1; $row <$arrCSV; $row++ )
{
echo ''.$arrCSV[$row]['6'].'';
}
?>
Then I would like it ONLY to output one of the columns [*] [6].
I think I should get here fist before I try the rest.
Any guidance would help.
I am trying to learn, so far I have got this far.
Thank you