 Gazdaman I did a trackday!!!

Joined: 12 Aug 2004 Karma :    
|
 Posted: 17:45 - 02 Dec 2006 Post subject: PHP help |
 |
|
| Code: | while (($data = fgetcsv($handle, 1000, ",")) !==FALSE) { //fgetcsv returns FALSE on error, including end of file.
$num = count($data);
for ($c=0; $c < $num; $c++) {
if ($data[$c] == $items) {
print "FOUND THE PICTURE IN THE DATA ARRAY! POSITION [b]$c[/b] !!!! See $data[$c] == $items<br />\n";
}
} |
Ok right, $data[] is an array containing A filename, a description, and a price, a filename, a description and a price...etc etc etc
$items is a filename, and there is code elsewhere, that makes it loop through various different filenames.
So basically, I'm looping through $data[] to find an record that matches $item, then I want to access the record after it, and the one after that. But to do that, I need to access the position.
Anyway, the above code works, but the bold $c always returns 0 when it's actually printed when it literally /can't/ be zero, because in my examples it prints it 3 times, and each time it's a different position in the array. So anyone have any ideas why $c = 0 each time?
Gaz
EDIT: The $c in question isn't in bold, but has bold tags around it. |
|
 bazza World Chat Champion
Joined: 27 Aug 2004 Karma :  
|
|
 Gazdaman I did a trackday!!!

Joined: 12 Aug 2004 Karma :    
|
|