I'm trying to filter out the rows of a uploaded csv that have the word "lokaal" (classroom) in the 3th colom, but this doesn't work.
What does work:
When I search for just one letter (for example the o) $findneedle is true, so it works
Putting $haystack="lokaal 5"; in the coding also works (but that is just usable for testpurposes)
echo $haystack does result in a correct value, so the csv is read correctly
<?
$handle = fopen($_FILES['file']['tmp_name'], "r");
$data = fgetcsv($handle, 1000, ";"); //Remove if CSV file does not have column headings
while (($data = fgetcsv($handle, 1000, ";")) !== FALSE)
{
$haystack=$data[2];
$needle='lokaal';
$findneedle=strpos($needle, $haystack);
if($findneedle !== false)
{
//rest of the coding
}
?>
The CSV looks like this
2013;Class 1;Zelfstudie;31-12-2013 0:00:00;1-1-1900 9:00:00;1-1-1900 12:00:00;
2013;Class 2;lokaal 5;27-12-2013 0:00:00;1-1-1900 15:00:00;1-1-1900 17:00:00;
Am I overlooking something? I hope someone can help me.