だから私はExcelファイルを持っています。返されるクエリが複数あります。ただし、これらすべてのクエリを一度に実行し、結果を Excel ファイルに出力する必要があります。
$col = 1;
while($row_data = mysql_fetch_assoc($result)) {
$row = 1;
if ($col == 1) {
$row_headings = array_keys($row_data);
foreach($row_headings as $value) {
$h = preg_split('/X/', $value);
if ($h[0] = $id and $h[2] != null){
$results="select question from lime_questions where sid =".$h[0]." and gid =".$h[1]." and qid =".$h[2]."; ";
echo $results;
//This is where the queries are returned.
//They are echoed to the first cell of the excel file
//They are returned as "query1;query2;..."
//This is where I am messing up.
//I am attempting to run the queries. I have been attempting many different approaches
$query_result = mysql_query($results[0]); //this does not return results of the queries
echo $query_result;
//attempting to show the results in the first cell of the excel file
}
//ideally at this point this foreach would print each query result in its own cell
foreach(mysql_query($results) as $value2){
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $value2);
$row++;
}
$row = 1;
$col++;
}