PHP:sprintf格式化excel文档

I have a script that takes my mysql query and writes to an excel file. I would like to add my own custom row before it writes the query results.I would like to add a "To date" and "From date". The query field names are on the first row but I would like to added it on the second row and then in the first row first cell "To Date : 22/01/2016" in the same row second cell I would like to put in "From Date : 22/02/2016". Currently the "From date" and second "To date" are on the second row.

<?php
$sQuery="SELECT * FROM tblnames;";

$rResult = mysql_query( $sQuery) or die();
$count = mysql_num_fields($rResult);

$html = '<table border="1"><thead><tr>%s</tr><thead><tbody>%s</tbody></table>';
$thead = '';
$tbody = '';
$line = '<tr>%s</tr>';
//my attempt 
$tbody = sprintf('<thead><tr>%s</tr><thead><tbody>%s</tbody>','','<tr><td>From Date : 22/01/2016</td><td>To Date : 22/02/2016</td></tr>');
// end of attempt
for ($i = 0; $i < $count; $i++){      
  $thead .= sprintf('<th>%s</th>',mysql_field_name($rResult, $i));
}


while(false !== ($row = mysql_fetch_row($rResult))){
  $trow = '';

  foreach($row as $value){
   $trow .= sprintf('<td>%s</td>', $value);
  }

  $tbody .= sprintf($line, $trow);

}


header("Content-type: application/vnd.ms-excel; name='excel'");
header("Content-Disposition: filename=exportfile.xls");
header("Pragma: no-cache");
header("Expires: 0");

print sprintf($html, $thead, $tbody);
exit;

//file_put_contents("exportfile.xls", $html.$thead.$tbody);
echo '<script>alert("COMPLETE")</script>';
?>