Awhile back, Sam messaged me about a database problem he’d been struggling with for a bit:
“I’m building this app… like basecamp for lawyers. The probelm im having is attaching clients to cases after their lawyer set up their case… But looking at my database tables, it occured to me that I have no idea what column to put that CaseID variable in. The client should only see the case the lawyer has “attatched him to” I was thinking that maybe I could insert the case ID in the client_register table by adding a new column….and then do some weird quadrupal inner join or something….but that doesnt seem right when I say it outloud.”
Sounds complicated…
But, the solution is pretty simple.
So, I told him and about and a few weeks later he sent me this:
“Hey thanks again for the help with join table, it worked perfectly.”
Within a month, he had completed his app, entered it into a competition and began running it as a cloud-based service. Eventually, he was even featured on USA Today. And, now also runs a coding bootcamp.
What did I show him?
Well, there’s only three types of database tables you’ll really ever need.
When you use these…
It keeps your database uber-flexible and scalable.
And, allows you to easily add new functionality to your app…
Without constantly re-structuring your database.
In fact, WordPress does this and has had basically the same database structure for years now. Through all its different iterations and feature enhancements, the database structure has remained largely the same.
In fact, a little while after I’d explained it to Sam…
He sent me this out of the blue:
“Thanks again by the way, explaining the r____________ tables has helped me on a ton of other projects.”
Which is the best part…
You can use this setup for any application.
Doesn’t matter what it does.
The setup is so flexible… it can handle virtually anything.
And, make your coding life about 1000 times easier.
Anyway, I show you how to do it step-by-step in Module 3 of PHP 101. Along with all the things you’d expect like CRUD, PDO, MySQLi, prepared statements, input filtering, prevent SQL injection attacks, output escaping and more.
If you want to get MySQL handled, this is how: https://johnmorrisonline.com/php
Later,
John