I'm try to use fwrite for format numbering to write in text file, but its doesn’t work.
Code:
if($result){
while($array=mysql_fetch_array($result)){
$xsupp = $array['SUPP'];
$xpartno = $array['XPART'] ;
$len = strlen($xpartno);
$xspace = 16 - $len;
$xpartno = $xpartno . str_repeat(" ",$xspace);
$xpn = $array['PN'];
$xcav = $array['tool_cav'];
$xqty1 = $array['QTY'];
$xqty2 = $array['TOTQTY'];
$stqty2 = number_format($xqty2);
$xshot = number_format(round($xqty2/$xcav,0));
$xamt1 = round($array['AMT'],0);
$xamt2 = round($array['TOTAMT'],0);
$stamt2 = number_format($xamt2);
$data = "$xsupp \t $xpartno\t\t $xpn \t\t $xcav \t\t";
$data2="\t\t";
$data3= " \r\n";
echo ("<tr><th>$xsupp</th><th>$xpartno</th><th>$xpn</th><th>$xcav</th><th align=\"right\">$xshot</th><th align=\"right\">$stqty2</th><th align=\"right\">$stamt2</th></tr>");
fwrite($fp,$xpartno);
fwrite($fp,$data2);
fwrite($fp,$stqty2,integer*4);
fwrite($fp,$data3);
}
Comment