Lo solucione asi,
$fid=fopen("archivo.txt","w+");
while($array=mysql_fetch_array($result)) {
$txt=$array['rif_ag_ret']."\t".$array['p_fisca']."\t".$array['f_fact']."\t".$array['iva_const']."\t".$array['iva_ttran']."\t".$array['rif_pro']."\t".$array['n_fac']."\t".$array['n_cfac']."\t";
fwrite ($fid, $txt . PHP_EOL);
}
fclose($fid);
pero tiene un detalle, me resta un registro, me explico, si encuentra 6 registro me muestra 5..... hice prueba con un solo registro y no muetra nada...
![Decabeza](http://static.forosdelweb.com/fdwtheme/images/smilies/decabeza.png)
alguna idea???