I have a
CVS file and a user input field that I need to see if it exists in that
CVS file.
Here is what Iīm using, but I canīt get it to work:
Code:
$input = $_GET["input"];
# Open the File.
if (($handle = fopen("http://www.skuli.us/cvs/demo.cvs", "r")) !== FALSE) {
# Set the parent multidimensional array key to 0.
$nn = 0;
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
# Count the total keys in the row.
$c = count($data);
# Populate the multidimensional array.
for ($x=0;$x<$c;$x++)
{
$csvarray[$nn][$x] = $data[$x];
}
$nn++;
}
# Close the File.
fclose($handle);
}
if (in_array($input, $csvarray)) { die('Found'); }
else { echo $input; die('Not found'); }
Even if I type in "1" as the input I get Not Found
I would like to find the
exact match to the user input.