DEV Community

Discussion on: How I Built a Blood Bank Management System from Scratch using PHP & MySQL

Collapse
 
xwero profile image
david duymelinck • Edited

Are you sure it works?

Looking at the index.php file, I don't see a pages directory. And using php files by name how it was done in the 2000's.
I'm not saying you need to follow all best practices, but the minimum for a current PHP project is the use of Composer.

While it is good you are using PDO the use of what need to be configurable variables scares me. At least use getenv.

While you claim to use MVC there are multiple files that mix backend code with CSS and HTML.
To make home MVC you need a public/home.php as the controller. A model/donors.php, model/users.php, model/donations.php, model/donationCamps.php and a model/bloodInventory.php as your models. And a views/home.php as the view.
It is true you don't need a framework, but you need a lot more files.

There is nothing wrong with using PHP without dependencies, I recommend it when you want to learn what is happening behind the screens of libraries and frameworks. The problem is that the repo looks like something that works on your computer but nowhere else.

Collapse
 
anushka_shinde_99 profile image
Anushka Shinde

Thank you for the detailed feedback!

You're right about everything. The folder structure is broken because I uploaded files incorrectly fixing that soon.

I hadn't used Composer or getenv before didn't even know about getenv until your comment honestly.

I've also updated the post changed "MVC-style" to "modular architecture inspired by MVC" and toned down the SQL injection claim. More accurate now.

Still learning this kind of feedback helps more than any tutorial. Thank you! 🙏

Collapse
 
xwero profile image
david duymelinck

Yes my comment is positive criticism. I don't want to force you to go into only best practices mode because then you don't experience why the best practises exist.

I gave you enough tips to make improvements, the rest is up to you.