Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Content-Type: application/xls");
- header("Content-Disposition: attachment; filename=download.xls");
- header("Pragma: no-cache");
- header("Expires: 0");
- require_once 'conn.php';
- $output = "";
- if(ISSET($_POST['export'])){
- $output .="
- <table>
- <thead>
- <tr>
- <th>ID</th>
- <th>Firstname</th>
- <th>Lastname</th>
- <th>Address</th>
- <th>Job</th>
- </tr>
- <tbody>
- ";
- $query = $conn->query("SELECT * FROM `member`") or die(mysqli_errno());
- while($fetch = $query->fetch_array()){
- $output .= "
- <tr>
- <td>".$fetch['mem_id']."</td>
- <td>".$fetch['firstname']."</td>
- <td>".$fetch['lastname']."</td>
- <td>".$fetch['address']."</td>
- <td>".$fetch['job']."</td>
- </tr>
- ";
- }
- $output .="
- </tbody>
- </table>
- ";
- echo $output;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment