5bbcf0ad by Yokihito Oki

csvエクスポート処理修正

1 parent e157d5f2
......@@ -9,16 +9,16 @@ $total_count = 0;
$db = new mysqli("127.0.0.1","root","KanoyaMbc1124","ad1216tnc7_kanoya","3306");
$db->set_charset('utf8');
$sql = 'SELECT * FROM d_feedback WHERE id > 9 ORDER BY id DESC';
$limit = $_POST['csv_export'] ? NULL : 100;
$limit_query = $limit ? ' LIMIT '.$limit : '';
$sql = 'SELECT * FROM d_feedback WHERE id > 9 ORDER BY id DESC'.$limit_query;
$row = $db->query($sql);
//mysqli_query($db, $sql);
while( $data = $row->fetch_object()){
$q1_ans = $data->q1;
$q2_ans = $data->q2;
$page_id = $data-> page_id;
if($total_count < 100){
$page_id = $data->page_id;
$html_hyo .= '<tr><td>';
if($page_id){
......@@ -34,9 +34,9 @@ while( $data = $row->fetch_object()){
if($q2_ans == 1) { $q2_count_g++; }elseif($q2_ans == 2) { $q2_count_b++; }
$html_hyo .= '</tr>';
}
//CSV書出用
$csv_page[] = $data_p->title;
$csv_page[] = $page_id ? $data_p->title : '';
$csv_q1[] = $q1_ask[$q1_ans];
$csv_q2[] = $q2_ask[$q2_ans];
$csv_input[] = $data->input_date;
......@@ -54,7 +54,7 @@ if($_POST['csv_export']) {
$csv_c = 0;
$csv_array = [];
while($csv_page[$csv_c]){
while(isset($csv_page[$csv_c])){
$csv_array[$csv_c][] = mb_convert_encoding($csv_page[$csv_c], 'SJIS-win', 'UTF-8');
$csv_array[$csv_c][] = mb_convert_encoding($csv_q1[$csv_c], 'SJIS-win', 'UTF-8');
$csv_array[$csv_c][] = mb_convert_encoding($csv_q2[$csv_c], 'SJIS-win', 'UTF-8');
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!