我設法回答我的問題。 這裏是我的代碼片段,
// SQl database connections
$db = mysql_connect("localhost", "IMC_COE2", "IMC123");
mysql_select_db("IMC_COE2",$db);
$sqlgroups="select client, team_name,support_team_prime,prime_comments,support_team_backup,backup_comments,escalation1,escalation1_comments,escalation2,escalation2_comments,escalation3,escalation3_comments,escalation4,escalation4_comments,note from tbl_address ORDER by team_name";
$resultgroups=mysql_query($sqlgroups);
$numrows=mysql_num_rows($resultgroups);
if ($numrows>0)
{
$count=2;
while($data=mysql_fetch_array($resultgroups))
{
$count+=1;
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('C3', $data['client'])
->setCellValue('B2', $data['team_name'])
->setCellValue('C5', $data['support_team_prime'])
->setCellValue('D5', $data['prime_comments'])
->setCellValue('C6', $data['support_team_backup'])
->setCellValue('D6', $data['backup_comments'])
->setCellValue('C8', $data['escalation1'])
->setCellValue('D8', $data['escalation1_comments'])
->setCellValue('C9', $data['escalation2'])
->setCellValue('D9', $data['escalation2_comments'])
->setCellValue('C10', $data['escalation3'])
->setCellValue('D10', $data['escalation3_comments'])
->setCellValue('C11', $data['escalation4'])
->setCellValue('D11', $data['escalation4_comments'])
->setCellValue('B13', $data['note']);
}
}