RE: array

From: Date: Tue, 25 Sep 2001 08:22:14 +0000
Subject: RE: array
Groups: php.general 
Request: Send a blank email to php-general+get-68663@lists.php.net to get a copy of this message
I can't see where any element of $link is set in the second piece of code. I assume they are separate examples. In the second example I would expect $link[$c] to always be empty. Tim Ward ---------- From: Jeremy Morano [SMTP:jeremy@prepresshelp.com] Sent: 24 September 2001 16:23 To: php-general@lists.php.net Subject: array Hello everyone. I'm encountering difficulties using my arrays. while ($row = mysql_fetch_array($result)) { $link[$c] = $row['link']; $c = $c + 1; } This is where I try using it. while ($row = mysql_fetch_array($result)) { $date = $row['date']; $path = $row['path']; $entry_name = $row['entry_name']; $company_name = $row['company_name']; $file = basename ($path); while ($c >= 0) { echo $link[$c]; if($file == $link[$c]) { $file = "This is new"; } $c = $c -1; } $contact_list2 .= "$date $file $entry_name $company_name\n"; } Comment: The echo $link[$c] works fine. It displays what it should. However the if statement does not because $file and $link[$c] are equal on several occasions yet the content of $file doesn't change... Thank You.

« previous php.general (#68663) next »