Hi Everyone,
I'm trying to compare a value to the first field in a csv fILE (example
of the data below). Using while takes too long and I can't figure out
how to compare just one row at a time. I've tried some variations of the
following.
//Common for all trials
$demoID = fopen("newDemoID.csv", "r");;
$ID = "43";
$data = fgetcsv($demoID);
First try with while:
/*
while ($data) {
if ($data[0] == $wolfID) {
print $data[1] . "," . $data[2] . "," . $data[3] .
".\n";
}
}
*/
Takes for every.
I can't use just the below because it only compares the first row.
/*
if ($data[0] == $wolfID) {
print $data[1] . "," . $data[2] . "," . $data[3] . ".\n";
}
*/
I know this is simple, but I've hit codes block due to lack of sleep.
Thanks,
Dan
Sample Data:
> 5,1,"Smith","Myrtle"
> 6,2,"Smith","Carita"
> 7,3,"Smith","Paul"
> 8,4,"Smith","Donald"
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php