What's wrong?
| From: | Sergio Augusto Bitencourt Petrovcic | Date: | Tue, 20 Nov 2001 11:58:31 +0000 |
| Subject: | What's wrong? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-14457@lists.php.net to get a copy of this message | ||
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!