set_charset('utf8');
//2.查詢資料表
$result = $conn->query("select * from books order by ".$a1);
//3.輸出全部資料
$rowall = $result->fetch_all(MYSQLI_ASSOC);
foreach($rowall as $item)
{
echo "
".$item["書籍編號"].','.$item["書籍名稱"].','.$item["價格"];
}
//4.關閉連線:close connect
$conn->close();
?>