Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Building a Web Application with PHP and MariaDB: A Reference Guide

You're reading from   Building a Web Application with PHP and MariaDB: A Reference Guide Build fast, secure, and interactive web applications using this comprehensive guide

Arrow left icon
Product type Paperback
Published in Jun 2014
Publisher
ISBN-13 9781783981625
Length 200 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Sai S Sriparasa Sai S Sriparasa
Author Profile Icon Sai S Sriparasa
Sai S Sriparasa
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. CRUD Operations, Sorting, Filtering, and Joins 2. Advanced Programming with MariaDB FREE CHAPTER 3. Advanced Programming with PHP 4. Setting Up Student Portal 5. Working with Files and Directories 6. Authentication and Access Control 7. Caching 8. REST API 9. Security 10. Performance Optimization Index

Data exports

Now that we have successfully imported data into our database, let's look at the process for exporting the data. In this section, we will look at two tasks: exporting the data to a file in the local filesystem and allowing a user to download that exported file. Let's begin by making a small change to the get.php view to add a link to export the data, using the following code. We will add the following line of code to the paragraph tag that contains the Import Students link:

<a id="exportStudentsLink" href="export">Export Students</a>

Here, we set the href attribute to the export action that we will be adding. As the name suggests, we will use the export action to export the student data into a CSV file, and allow the users to download this data. Before we go over the export action, we need to make three updates to the existing code. The first change will be to add a constant that will hold the root-working directory to our config.php...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime