Chapter 2. Connecting to MySQL: How it fits together

image with no caption

Knowing how things fit together before you start building is a good idea. You’ve created your first PHP script, and it’s working well. But getting your form results in an email isn’t good enough anymore. You need a way to save the results of your form, so you can keep them as long as you need them and retrieve them when you want them. A MySQL database can store your data for safe keeping. But you need to hook up your PHP script to the MySQL database to make it happen.

Owen’s PHP form works well. Too well...

image with no caption

Owen’s email script was fine when he was only getting a few responses, but now he’s getting lots of emails, far more than he can manage.

He’s accidentally deleted some without reading them. And some are getting stuffed in his spam folder, which he never checks. In fact, an email he’d be very interested in seeing is hidden away in his spam folder right this moment... Owen needs a way to store all the messages so he can look at them when he has time and easily find ones related to Fang.

image with no caption

MySQL excels at storing data

Owen really needs a way to store the alien abduction report data in a safe place other than his email Inbox. What he needs ...

Get Head First PHP & MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.