Hi,
the most probable reason is that the file you're reading from was saved in a
different filesystem and the $info[2] has some newline characters at the
end.

You can use the trim() function to remove it. Than your expression will look
something like this
if(count($info) != 1 && $folder == trim($info[2]))

HTH
Dobromir Velev

-----Original Message-----
From: Sergio Augusto Bitencourt Petrovcic <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tuesday, November 20, 2001 13:58
Subject: [PHP-DB] What's wrong?


>Ho there...I really wonder what's wrong with this script. The error is in
>this line below:
>if((count($info) != 1) && ($folder == $info[2])) echo "<table><tr><td><a
>href=" . $info[1] . ">" . $info[0] . "</a><br></td></tr></table>";
>The condition ($folder == $info[2]) is not working!
>I hope you can help me!
>Here's the code:
>
><?php
>
>$link_name = "Tudo sobre automação";
>$link_address = "http://www.automacao.eng.br";;
>$link_folder = "faculdade";
>$file = "teste.txt";
>
>function write($file,$link_name,$link_address,$link_folder) {
> $file=fopen("$file","w");
> fwrite($file,"$link_name|$link_address|$link_folder\n");
> fclose($file);
>}
>
>function read($file,$folder) {
> $file=fopen("$file","r");
> while (!feof ($file)) {
>  $buffer = fgets($file,1024);
>  $info = explode("|",$buffer);
>  if((count($info) != 1) && ($folder == $info[2])) echo "<table><tr><td><a
>href=" . $info[1] . ">" . $info[0] . "</a><br></td></tr></table>";
> }
> fclose($file);
>}
>
>write($file,$link_name,$link_address,$link_folder);
>read($file,"faculdade");
>
>?>
>
>Thanks!
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to