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
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
The PHP Workshop

You're reading from   The PHP Workshop Learn to build interactive applications and kickstart your career as a web developer

Arrow left icon
Product type Book
Published in Oct 2019
Publisher Packt
ISBN-13 9781838648916
Pages 604 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (8):
Arrow left icon
Markus Gray Markus Gray
Author Profile Icon Markus Gray
Markus Gray
David Carr David Carr
Author Profile Icon David Carr
David Carr
Bart McLeod Bart McLeod
Author Profile Icon Bart McLeod
Bart McLeod
Mark McCollum Mark McCollum
Author Profile Icon Mark McCollum
Mark McCollum
Alexandru Busuioc Alexandru Busuioc
Author Profile Icon Alexandru Busuioc
Alexandru Busuioc
Jordi Martinez Jordi Martinez
Author Profile Icon Jordi Martinez
Jordi Martinez
M A Hossain Tonu M A Hossain Tonu
Author Profile Icon M A Hossain Tonu
M A Hossain Tonu
Vijay Joshi Vijay Joshi
Author Profile Icon Vijay Joshi
Vijay Joshi
Arrow right icon
View More author details
Toc

Introduction

In the previous chapter, we saw how to deal with user input using PHP superglobals and applied sanitization and validation in order to secure the application. We also learned how to keep the user's session on the server and built a small application. In that application, we used the session to store data, which vanished with every session destroyed (or logout).

In this chapter, we will learn how we can store and read persistent data using PHP. Specifically, we will learn how to handle file I/O (open, read, and write) and disk operations (change the current directory, create a new file/directory, remove a file or directory, and so on). This is useful when you would like to use the filesystem for precious application logs, to generate all kinds of reports, to handle uploaded user images, and so on. We will also learn how to connect to a MySQL database and how to query the data, insert new records, and update or delete data from the database. This is helpful when...

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 £16.99/month. Cancel anytime