Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
We can store data on a server using databases and other file systems, but we can also use the user's browser to store information about a particular user even when they're not logged in to our application.
Types of Persistence
Other Courses
- Databases: Integrating Databases with PHP
- Files: File Handling with PHP
This course
- Forms: Using Forms for Persistence
- Sessions: Reading Writing and Destroying Sessions
- Cookies: Writing Cookies
Welcome back.
0:04
Did you enjoy working with databases?
0:05
Welcome back.
0:08
I am glad you decided
to keep working hard.
0:08
I know that last course took
longer than usual to get through.
0:11
Hello and welcome, I am Elena,
a PHP programmer for
0:15
over 15 years, and
a teacher here at Tree House.
0:19
I'll be your guide through
this journey into PHP.
0:22
I'm glad you've chosen to allow tree
house to help you reach your goals.
0:25
Doesn't it make you feel special
when contents speak directly to you?
0:29
And it makes it so much easier
to find things on our phones and
0:33
computers seem to know what we
are looking for, even before we ask.
0:36
Which is to expect our phones to know
our locations, when we are looking for
0:41
a local service or
trying to get directions.
0:44
Websites like Amazon make suggestions
of things we may like to see, and
0:47
tell us when our favorite authors
are releasing their latest books.
0:51
If you plan a trip using Expedia, the
website keeps track of recent searches for
0:55
you in a scratch pad.
1:00
This makes it easy to jump back to
view different choices for the trip.
1:02
This scratch pad is available without
requiring users to be logged in.
1:06
Most of the time, we don't even
realize how much our devices or
1:11
websites are set up to assist us until
we try to use a different device or
1:14
a new phone and all of a sudden, our
history and settings aren't there anymore.
1:19
And it's so much harder to do or
find anything.
1:23
Users have come to expect so
much and it's just getting worse.
1:27
So, what does that mean
to you as a programmer?
1:31
How can you make your own
applications user aware?
1:33
It starts with data persistence.
1:37
The idea of storing information for
a prolonged period of time.
1:40
HTTP, the protocol for exchanging data on
the internet, is a stateless protocol.
1:45
This means,
1:50
that web servers don't normally keep track
of who's visiting each page on a site.
1:51
Servers also don't keep track of visitors
as they click from page to page.
1:57
For example, say I visited a sites welcome
page, and then I visited the contact page.
2:01
The server doesn't keep
track of that progress and
2:07
doesn't know that I was
just on the welcome page.
2:10
There are a number of different options
for working with persistent data.
2:13
If you've worked with a database or
2:17
any file-based data storage, you've
already worked with persistent data.
2:19
Multiple pages can access and
know about this same information.
2:23
This form of persistance works well when
we want data to be stored long term or
2:28
be utilized by multiple users.
2:33
We can also make use of a users browser
to keep track of specific information and
2:36
tailor the users experience.
2:41
In this course,
we'll put together a story building game
2:44
that will utilize different types
of browser-based persistence.
2:47
The games steps the user through
multiple pages that ask the user for
2:51
specific types of words.
2:55
Those words will be used in predefined
locations of the string to create an often
3:06
comical or nonsensical story.
3:11
At the end, a user will be able
to save a story to re-read later.
3:14
A user can also play the game again
as many times as they'd like.
3:22
You need to sign up for Treehouse in order to download course files.
Sign up