I am trying to print fields from DB on .xls excel as:
$sql="select * from bill ";
$result=mysql_query($sql);
while($row = mysql_fetch_array($result)){
$ARP=$row['ARP_name'] ;
$nam=$row['student_name'] ;
$doc=array("ARP name"=>array('ARPname'=>($ARP),'name'=>$nam));
}
$xls->addArray ( $doc );
but the printing result is just the last record from DB , I want all the records to be printing
Because your braces are wrong:
The brace needs to be after this line:
So, the full code would be: