ignoring multiple entries from a CSV file.
Posted: Thu Nov 26, 2009 2:01 pm
Hiya 
I have a search function on a webpage, and when someone searches for something, i want it too appear in a section of the admin panel....i have achieved this using a .csv file and the following script:
Now,what i need it to do, is if the timestamp column is the same (which would be stored as $data[3] in each case...) skip that entry and move to the next...what modifications should i make?
I have a search function on a webpage, and when someone searches for something, i want it too appear in a section of the admin panel....i have achieved this using a .csv file and the following script:
Code: Select all
<?php
$row = 1; // a counter for line numbers
$handle = fopen("test.csv", "r"); // open the test.csv file for reading
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { // while there are still lines to read
$num = count($data); // the number of columns
$row++; // next row
for ($c=0; $c < $num; $c++) {
echo $data[$c] . "<br />\n"; // print everything in the row
}
}
fclose($handle); // close the file
?>