EBOOKS
Create CSV
View CSV
Submit to Archive.org
Go to Archive.org
//$data = 1;
//$statement->bindValue(':data', $data);
<?php
include('/var/www/html/jm/dacode/connection.php');
$sql = "SELECT * FROM book";
$statement = $conn->prepare($sql);
$statement->execute();
echo $statement->rowCount() . " records SELECTED successfully <br>";
//Fetch all of the rows from our MySQL table.
$rows = $statement->fetchAll(PDO::FETCH_ASSOC);
//Get the column names.
$columnNames = array();
if(!empty($rows)){
//We only need to loop through the first row of our result
//in order to collate the column names.
$firstRow = $rows[0];
foreach($firstRow as $colName => $val){
$columnNames[] = $colName;
echo $colName . "<br>";
}
}
$conn = null;
$list = array
(
"Peter,Griffin,Oslo,Norway",
"Glenn,Quagmire,Oslo,Norway",
);
$file = fopen($pathda."/upbook.csv","w");
foreach ($list as $line)
{
fputcsv($file,explode(',',$line));
}
fclose($file);
echo "test s";
echo $_SERVER['DOCUMENT_ROOT'];
?>