Экспорт данных mysql в MS excel хорошо работает в локальной среде, но не на сервере
The code is simple. Working well in local. But when i use this in my website on server. It shows only Table with data. It don't export that data in excel. Please help ASAP. order_no order_date order_name total_amount 100000705 2017-05-07 MR. PRADEEP Y 113500 100000708 2017-05-11 MR. A SRINIVASA RAO 5448 100000725 2017-05-30 MR. A SRINIVASA RAO 77180 Here is the result I can see when i click on export link. In local wampserver, It is easily exported.
Что я уже пробовал:
<pre><title>Orders Export</title> <body> <?php header('Content-Type: application/xls'); header('Content-Disposition: attachment; filename=download.xls'); $con = mysqli_connect('localhost','suresafe_admin','iwant$100','suresafe_suresafety'); $query = "select * from `orders_approval` where `approve`='1' and `company_name`='GAVL-F111'"; $result = mysqli_query($con,$query); $output = ''; if(mysqli_num_rows($result) > 0) { $output .= '?> <table class="table" bordered="1"> <tr> <th>order_no</th> <th>order_date</th> <th>order_name</th> <th>total_amount</th> </tr><?php '; while($row = mysqli_fetch_array($result)) { $output .= ' <tr> <td>'.$row["order_no"].'</td> <td>'.$row["order_date"].'</td> <td>'.$row["order_name"].'</td> <td>'.$row["total_amount"].'</td> </tr> '; } $output .= '</table>'; }?> </body> </html>