Arkadaşlar aşağıdaki kodla tarih alanındaki 2015-07 ile başlayan verileri listeliyorum. Echo ile ekrana bastığımda herhangi bir problem yok. Fakat amacım bu kayıtları txt yada csv içerisine kayıt ettirmek. fopen ile bunuda yapabiliyorum. Fakat sadece en son kaydın olduğu satırı kaydediyor dosyaya. Döngümde bir problemmi var?


$listele = mysql_query("SELECT * FROM radacct where tarih like '2015-07%'  ");

	while($cek=mysql_fetch_array($listele)){
		
		
		$username			= $cek['username'];
		$framedipaddress	= $cek['framedipaddress'];
		$callingstationid 	        = $cek['callingstationid'];
		$acctstarttime		= $cek['acctstarttime'];
		$acctstoptime		= $cek['acctstoptime'];
		
			@extract ($username);
			@extract ($framedipaddress);
			@extract ($callingstationid);
			@extract ($acctstarttime);
			@extract ($acctstoptime);
		
				$birlestir = $username."\t".
							 $framedipaddress."\t".
							 $acctstarttime."\t".
							 $callingstationid."\t".
							 $acctstoptime;
							 echo "\n";
							 
	
				//LOG DOSYASI OLUŞTUR
				$log_dosya_isim_yaz	= date("Y-m-d_H-i-s");
				
					$log_ac = fopen($log_dosya_isim_yaz.".txt", 'w');
						fwrite($log_ac, $birlestir);
						
				echo $birlestir;			
						
	}