Форум сетевых администраторов
Показаны 7 сообщений на этой странице

Форум сетевых администраторов (http://netadmin.ws/forum/index.php)
- PHP (http://netadmin.ws/forum/forumdisplay.php?forumid=6)
-- edit ... (http://netadmin.ws/forum/showthread.php?threadid=7210)


Помещено MagosTek 04-12-2003 в 21:56:

edit ...



PHP:


$entry 
= file('./data/all.dat');
$count = count($entry);
$open = fopen('./data/all.dat','w') or die ("Error!");  
flock($open,1);  
flock($open,2);                     

for (
$i = 0; $i < $count; $i++){  
     list(
$c,$data,$d,$ti)=explode("::",$entry[$i]);  
      
if(
$c === $r){     
               
$tit = htmlspecialchars(stripslashes($tit));
               
fwrite($open,$c."::".$art."::".$d."::".$tit."::\r\n");
               
fclose($open);
                     } 
    }



problema v tom chto kogda update delay vse ostalnie novosti v file ynichtozaetsia ... gde oshibka ...

__________________
..:<------nothing is real------>:..


Помещено rio 05-12-2003 в 08:49:

Все очень просто :


code:

for ($i = 0; $i < $count; $i++){   
     list($c,$data,$d,$ti)=explode("::",$entry[$i]);   
       
if($c === $r){      
               $tit = htmlspecialchars(stripslashes($tit)); 
               $new .= "$c"."::"."$art"."::"."$d"."::"."$tit"."::\r\n"; 
                     } 
    }
               fwrite($open,$new); 
               fclose($open); 

__________________
Ковчег построили дилетанты, а профессионаллы построили "Титаник" - не бойтесь спрашивать то , чего вы не знаете , а так же делать то - чего не умеете !


Помещено MagosTek 05-12-2003 в 13:07:

I yze takoe delal ... tolko ne rabotaet ... ono ynichtozaet vse ostavliaia tolko tot kotorii update delay ...

__________________
..:<------nothing is real------>:..


Помещено Nevermind 05-12-2003 в 16:23:

Дык ключ "w" в fopen() открывает файл с уничтожением всех данных в нем (RTFM).


Помещено MagosTek 06-12-2003 в 13:31:

роставил 'W+' то же самое

__________________
..:<------nothing is real------>:..


Помещено polo 06-12-2003 в 14:44:

http://es.php.net/fopen
w+ - Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
a+ - Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.

делай выводы.

__________________
Всегда есть решение.


Помещено MagosTek 06-12-2003 в 15:39:

Talking

так проблема решена
спасибо за помощ


PHP:


while($string=array_pop($entry))
    {
     list(
$c,$data,$d,$ti)=explode("::",$string);   
if(
$c === $r){      
               
$tit = htmlspecialchars(stripslashes($tit)); 
               
$new .= "$c"."::"."$art"."::"."$d"."::"."$tit"."\r\n";
               
fwrite($open,$new); 
               } 
else {
    
//echo $string;
    
fwrite($open,$string);
    }
    }
    
fclose($open);



ny nyzno eshe nemnozko pochistit .. eto potom ...

__________________
..:<------nothing is real------>:..


Формат времени GMT. Текущее время 11:48.
Показаны 7 сообщений на этой странице

Powered by: vBulletin Version 2.2.4
Copyright © Jelsoft Enterprises Limited 2000, 2001.