problem with fclose

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
visonardo
Forum Contributor
Posts: 136
Joined: Mon Oct 02, 2006 7:49 pm
Location: Argentina, South America´s Sun.

problem with fclose

Post 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? :?:
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: problem with fclose

Post by Jonah Bron »

Are you sure you have writing permissions?
Post Reply