 |
|
Code (PHP)
mysql_select_db($database_db_conn, $db_conn);
mysql_query('SET CHARACTER SET tis620');
$query_exportQue = sprintf
("SELECT tb_question.questionText,tb_question.questionNo,tb_question.questionID
FROM tb_question,tb_answer
WHERE tb_question.questionID = tb_answer.questionID
GROUP BY tb_answer.questionID");
$exportQue = mysql_query($query_exportQue, $db_conn) or die(mysql_error());
$totalRows_exportQue = mysql_num_rows($exportQue);
$row_exportQue = mysql_fetch_array($exportQue);
$filName = "answer.csv";
$objWrite = fopen("answer.csv", "w");
do{
fwrite($objWrite, "\"$row_exportQue[questionText]\",");
mysql_select_db($database_db_conn, $db_conn);
mysql_query('SET CHARACTER SET tis620');
$query_exportPart =
"select tb_choice.choiceText
from tb_answer,tb_choice
where tb_answer.choiceID = tb_choice.choiceID
and tb_answer.questionID = '$row_exportQue[questionID]' ";
$exportPart = mysql_query($query_exportPart, $db_conn) or die(mysql_error());
$totalRows_exportPart = mysql_num_rows($exportPart);
do{
fwrite($objWrite, "\"$row_exportPart[choiceText]\"\n");
}while($row_exportPart = mysql_fetch_array($exportPart));
// fwrite($objWrite, "\n");
}while($row_exportQue = mysql_fetch_array($exportQue));
มันออกมาเป็นแบบนี้คับ

แต่ผมต้องการให้เป็นแบบนี้คับ

รบกวนท่านผู้รู้ช่วยชี้แนะด้วยคับ ขอบคุณคับ
Tag : PHP
|
ประวัติการแก้ไข 2011-02-05 21:34:04
|
 |
 |
 |
 |
Date :
2011-02-05 21:27:04 |
By :
lengza |
View :
1322 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |