У меня есть этот код, и он уже экспортирует mysql в csv.Удалить имя столбца (экспорт mysql в CSV)
Но он также экспортирует имена столбцов таблицы.
Я хочу удалить имена столбцов.
Какую часть я должен удалить или переписать?
<?php
include('connection.php');
//header to give the order to the browser
header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=exported-books.csv');
//select table to export the data
$select_table=mysql_query('select accessionnumber,datereceived,author,booktittle,bookcategory,format,callnumber,isbn,publisher,photo,barcodeid,times,addedby from books');
$rows = mysql_fetch_assoc($select_table);
if ($rows)
{
getcsv(array_keys($rows));
}
while($rows)
{
getcsv($rows);
$rows = mysql_fetch_assoc($select_table);
}
// get total number of fields present in the database
function getcsv($no_of_field_names)
{
$separate = '';
// do the action for all field names as field name
foreach ($no_of_field_names as $field_name)
{
if (preg_match('/\\r|\\n|,|"/', $field_name))
{
$field_name = '' . str_replace('', $field_name) . '';
}
echo $separate . $field_name;
//sepearte with the comma
$separate = ',';
}
//make new row and line
echo "\r\n";
}
?>
ТИА
Показать пример того, что в настоящее время он возвращается. – Mave
accessionnumber, datereceived, author, booktittle, bookcategory, format, callnumber, isbn, publisher, photo, barcodeid, times, addedby 1,2014-12-10, saafv, qsadfsa, Technology (Applied Science), Serial, 1241, sadfasf , sadgda, Blue hills.jpg, 2014-00000001,, ges Здесь показаны столбцы таблицы, пожалуйста, помогите –