Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Presley Cobb
Presley Cobb
9,214 Points

Working with wordpress database

I need to write a plugin that creates a form on my website takes in inputs and writes that date to the database. Then I need to be able to call that data from the database. A lot of the tutorials I see on the internet are really complicated and aren't really as simple as what im trying to do. Does treehouse have a course that goes through how to do this or can anyone point me to where I can learn how to input data and do simple database queries?

1 Answer

Presley,

Wordpress files that access the SQL database are written in PHP. If you really want to do this from scratch, you could create a plugin yourself that uses something like Firebase as a data solution rather than MySQL. The API is as simple as APIs get (plus there's a GUI on the back end). If you click this link there's a 10 minute interactive tutorial that will teach you how to do exactly what you are describing above, but this assumes that you are comfortable building the entire app from scratch...

Honestly, If I were you, I would take Hampton Paulk's PDO with PHP and Randy Hoyt's PHP with MySQL. Make sure you can read and write code to perform basic CRUD operations with PHP. Then you could head on over to GitHub and look through some source code for popular forms plugins that already create SQL tables from user input. Hack out the mailer and whatever else you don't want, build a page to access the table from that plugin, and echo user entries back into the site.

Good luck!