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 trialSteven McKay Lowry
2,015 PointsConstant connection of variable to MYSQL.
Trying to make a constant connection to a mysql database.
For example:
I want to use - form data > mysql database > held in config.php.
This is so when the admin logs in, they use the form to change details on the site, which are held on the mysql database, and are pushed to the live page.
Hope this makes enough sense.
1 Answer
thomascawthorn
22,986 PointsI don't think you're looking for a constant connection...
It sounds more like you're looking for a CMS (content management system) like Wordpress - where admin users can log in and write/edit content.
Have you seen the wordpress courses here on Treehouse? There's a whole track!
Steven McKay Lowry
2,015 PointsSteven McKay Lowry
2,015 PointsThanks for the reply.
This is more for a project i'm working on, than a program i can use.
thomascawthorn
22,986 Pointsthomascawthorn
22,986 PointsNo worries - I would still suggest looking at Wordpress because it might give you a bit of an insight into what you're aiming for ;)
Your suggestion covers two areas - authentication (logging in) and database access.
I imagine your app would have somewhere an user (admin or otherwise) can log in to, and in that section of the site, they can change or create content?
I would have a trial run with an absolute classic (the 'hello world' equivalent of applications) - the blog.
You'd have an admin user that can create, edit and delete blog posts, and they'd have to log into a specific place to perform those actions. All you need in your database is a text field and a title field.
I would concentrate first on the CRUD (Create, Read, Update, Delete) portion first before restricting those actions to certain users. I.e. build all the forms, functions and pages you need and then add the 'logging in' bit. Have you checked out the MySQL/Database courses? That would be the first place I'd start. You could also look at the Shirts 4 Mike course, which looks into MySQL - specifically the 'show' (or 'read' part of CRUD). In other words, the shirts are sitting in a database, but you can only pull out the data, it doesn't cover adding it in.
You could always start on the shirts 4 mike course and add an admin system for adding, removing and editing products, but I would beign by creating your database and working out how to show the data on your website before moving onto creating/editing.