Page 1 of 1

problem with fclose

Posted: Thu Jan 24, 2008 5:22 pm
by visonardo
i have this two files where im using fclose:

1º file (this dont show error message)

Code: Select all

include('conection.php');
$link=conectarse();
 
$tablas=array();
$query=mysql_list_tables('d60336329',$link);
while(($row=mysql_fetch_row($query))){
    $tablas[]=$row[0];
}
$hola=implode("\n",$tablas);
$fp=fopen('tablas.txt','w');
fputs($fp,$hola);
fclose($fp);
$f=file('tablas.txt');
echo '<a href="tablas.txt">tablas ('.count($f).')</a>';


and this other, that show this error message

Code: Select all

Warning: fopen(tablas.txt) [function.fopen]: failed to open stream: Unknown error: 0 in int2.php on line 16
here is int2.php file

Code: Select all

 
 
$m=file('tablas.txt');
 
for($i=0;$i<count($m);$i++){
    if($m[$i]==$_GET['t']){
        $m[$i]=false;
        break 2;
    }
}
 
$h=array_filter($m);
echo count($h).' <= @ => '.count($m).'<p>';
 
$hola=implode("\n",$h);
$fp=fopen('tablas.txt','w');
fputs($fp,$hola);
fclose($fp);
$f=file('tablas.txt');
echo '<a href="tablas.txt">tablas ('.count($f).')</a><p>';
 
how can fix this problem? :?:

Re: problem with fclose

Posted: Thu Jan 24, 2008 7:53 pm
by Jonah Bron
Are you sure you have writing permissions?