![]() |
Показаны 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)
edit ...
$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);
}
}

__________________
..:<------nothing is real------>:..
Все очень просто :
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);
__________________
Ковчег построили дилетанты, а профессионаллы построили "Титаник" - не бойтесь спрашивать то , чего вы не знаете , а так же делать то - чего не умеете ! 
I yze takoe delal ... tolko ne rabotaet ... ono ynichtozaet vse ostavliaia tolko tot kotorii update delay ...
__________________
..:<------nothing is real------>:..
Дык ключ "w" в fopen() открывает файл с уничтожением всех данных в нем (RTFM).
роставил 'W+' то же самое
__________________
..:<------nothing is real------>:..
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.
делай выводы.
__________________
Всегда есть решение.
так проблема решена
спасибо за помощ
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);

__________________
..:<------nothing is real------>:..
| Формат времени GMT. Текущее время 11:48. | Показаны 7 сообщений на этой странице |
Powered by: vBulletin Version 2.2.4
Copyright © Jelsoft Enterprises Limited 2000, 2001.