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

PHP

Request: MySQL login system!

Hi! I'm in the process of building my first website. And i'm looking for a easy way to get login system. I have been looking at a couple of diffrent tutorails on the net. But most of them seem to be outdated somehow. Could somebody provide a (simple) tutorial on how to make a login system taking information from a mysql server. Also having the possibility to sign up. So an fully made login system, with welcome mails etc. is this possible to get in a short tutorial? Thanks

9 Answers

Deleted User

well, that is exactly what i am waiting to learn, but there is only few php tutorials here, and its about the eCommerce. god only knows how this is supposed to be the basic tutorial.

Are you looking to do this in basic PHP or MVC format?

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

@Adam, I'm afraid that couldn't all be covered in a simple tutorial. :~) Signups, authentication, welcome emails, etc. are all pretty complicated. I would definitely recommend using a PHP framework to get something like that in place: I hope to cover that in a tutorial later this year.

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

@Mahad abdi, My PHP tutorials aren't really about ecommerce. I do build a simple ecommerce website, but all the ecommerce components are handled by simple PayPal buttons. The first few tutorials cover the very basics like what a PHP command looks like, how it is related to HTML in generating a web page, the basics of variables and conditionals, and so on. Have you tried them out and found them too advanced for a beginner? If so, I'd love to hear your feedback!

Deleted User

No i have not found them difficult at all. it is just that when i saw your advertise, it said that you would teach everything there was to know about web designing, anyway now i know what you guys teach, can you just let me know what you will be covering next, hopefully you will include things like mysql, login and logging out system, ftp, am sure all that cant be included in one tutorial but hopefully it will in the following tutorials...

By the way i like your way of teaching, especially when u joke, yea i think "i have learnt enough to be dangerous"

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

Hey @Mahad,

The next round of tutorials will be looking at intermediate PHP programming techniques. We'll be enhancing the Shirts 4 Mike site. I'm putting together the list of videos for this now, and we should have that up on the Roadmap soon. Here are some of the things we'll be covering:

  • XSS attacks and escaping output
  • htaccess files and rewrite rules
  • more PHP functions like empty, strpos, array_reverse
  • refactoring code and design patterns
  • better code organization with separation of concerns and MVC
  • reading the PHP manual
  • data types
  • searching products

I won't be looking at MySQL in this project, but that will be a major focus in the following one.

Randy:

I won't be looking at MySQL in this project...

Why's that? I learnt a bit of basic MySQL and it didn't seem advanced or anything, in fact some of the things you list seem even more advanced than MySQL.

MySQL would fit in well. Storing the catalog data in a database would make more sense than using an array. It seems like you chose to use the array to avoid having to cover MySQL, which is strange because as I said it doesn't seem that advanced.

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

Hey @Charles,

We'll definitely be connecting to MySQL in the third version of the Shirts 4 Mike site. You are right that it would fit in well: that's exactly how you'd do it for a real site once you had a handle on all the basics.

Here are the two reasons I'll be covering these other topics first:

(1) There are plenty of jobs that require writing PHP code but not writing SQL statements. Often a senior developer will set up the database structure and all the code that connects to the database, while a less-senior developer will write the code that displays the data from the database on a web page.

A developer in that less-senior role may be required to go fix a bug happening at the [/people/edit/12] web address; that developer will need to understand many of these topics (rewrite rules, MVC) to know to look in either the /controllers/people.php file or in the /views/people/edit.php file. They'll unlikely need to know any SQL for that.

(2) I suppose it's easy enough to create a database through a control panel, add data, and write a query. But it's tricky to do it correctly:

  • keeping all your database connection code modularized for the whole app
  • limiting queries for performance reasons
  • understanding how to handle exceptions when integrating with another system

In the second Shirts 4 Mike project, we'll learn all about organizing code logically. Then when it's time to add the database, we'll have a good structure in place to build on.

We started at knowing absolute no PHP. We got a simple dynamic site working in the first version. We'll get it organized, modular, and extendable so we can easily add some features in the second version. Then we'll connect it to a database and a few other things in the third version.

Hi Randy,

I am also looking for a logon & registration system, will you be doing a tutorial on this any time soon?

If not do you have any suggestions or specific websites to learn this using php?