Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Integrating PHP with Databases Databases and PHP Getting to Know the Project

Creating a Database

How can I create my own .db file and insert data into it with PHP?

satria saefudin
satria saefudin
497 Points

Yes, I felt there was a "missing link" from previous lessons (https://teamtreehouse.com/library/build-a-basic-php-website). database.db file came out of nowhere? +1 for this question.

1 Answer

First of all, you need to choose and install the DB application like MYSQL, Oracle or etc. Then, you declare two the String variables in PHP. One is for the insert statement(query) and one for the date you want to insert. Then it will be sent to your database. I can't tell you all the details but this is how it works. If you have any further question, please ask me.