Как экспортировать CSV-файл с каждым столбцом в другой строке Переполнение стека

Я хочу экспортировать данные из веб-страницы php в CSV-файл, что я мог бы сделать, так как есть больше столбцов, которые утомительно читать, есть ли способ получить транспонирование строки или получить каждый столбец в новой строке ,

Я включил код

<?php

require_once 'elements.php.inc';
require_once 'functions.php.inc';
require_once 'lang.php.inc';

ini_set("auto_detect_line_endings", true);
/*header('Content-Disposition: attachment; filename="details.csv";');
ob_start();
session_start();
require_once 'config.php';

// if session is not set this will redirect to login page
if( !isset($_SESSION['user']) ) {
header("Location: login.php");
exit;
}
*/
// output headers so that the file is downloaded rather than displayed
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=data.csv');

// create a file pointer connected to the output stream
$output = fopen('php://output', 'w');

// output the column headings
fputcsv($output, array('Client', 'Contact client','Project Name','Author','Launch date','Category','Application Status','Current number of users','Number of users at launch','2vc Contact','Market','Ios(10+)','Android(4.3+)','Windows 7 Desktop','Windows 8.1 Desktop','Windows 8.1 Mobile','Windows 10 Desktop','Windows 10 Phone','Browser(Current Generation)','Blackberry(OS 10)','Ipad 3','Ipad 4','Ipad Air 1','Ipad Air 2','Ipad 5','Ipad Pro 1st','Ipad Pro 2nd 12.9"','Ipad Pro 2nd 10.5"','Ipad Mini 1','Ipad Mini 2','Ipad Mini 3','Ipad Mini 4','Iphone 4/4s','Iphone 5/5s','Iphone 6/6s','Iphone 6/6s+','Iphone 7','Iphone 7+','Iphone 8','Iphone 8+','Iphone X','Android Tablet','Andriod Tablet 4:3','Android Tablet_16:10','Andriod Tablet 16"9','Andriod Tablet Resolution','Andriod Tablet Vendorname','Andriod Tablet Productname','Andrio Smartphone','Andriod Smartphone 4:3','Andriod Smartphone 16:10','Android Smartphone 16:9','Android Smartphone Resolution','Android Smartphone Vendorname','Android Smartphone Productname','Windows Tablet','Windows Tablet 4:3','Windows Tablet 16:10','Windows Tablet 16:9','Windows Tablet Resolution','Windows Tablet Vendorname','Windows Tablet Productname','Windows Smartphone','Windows Smartphone 4:3','Windows Smartphone 16:10','Windows Smartphone 16:9','Windows Smartphone Resolution','Windows Smartphone Vendorname','Windows Smartphone Productname','Windows Desktop','Windows Desktop 4:3','Windows Desktop 16:10','Windows Desktop 16:9','Windows Desktop Resolution','Windows Desktop Vendorname','Windows Desktop Productname','Windows Touchscreen','Windows Touchscreen 4:3','Windows Touchscreen 16:10','Windows Touchscreen 16:9','Windows Touchscreen Resolution','Windows Touchscreen Vendorname','Windows Touchscreen Productname','User Management','CMI','MyData - per user','MyData - global','Asset Library','E-Mail Asset Box','Contact Form','Analytics','Push','Multi Language','Number of languages','MDM','MDM Name','On Premise Installation','APIs / Gateways','API details','Apple enterprise distribution (non-public)','Apple AppStore (public)','Dev profile for Apple','Windows Marketplace (public)','Google play (public)','Design by','Additional features','Link to DevKit','Appname on Homescreen','Offline'));

// fetch the data

$rows = selectRows($_REQUEST['id']);
// loop over the rows, outputting them
while ($row =  mysqli_fetch_assoc($rows)) fputcsv($output, $row, ',', '"');
?>

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector