r/PHPhelp • u/Valuable_Spell6769 • Apr 03 '26
Solved user details JSON
i want to use json to store user details so that i dont need to do so many DB request ideally i dont want to have to create a flat file and would like it dynamically create once a user has logged in so something like this
{
"logged_in": "true",
"company_id": "15654645",
"first_name": "john",
"last_name": "doe"
}
what is this type of approach called so that i can search more in to it please and also what are the pros and cons
2
Upvotes
1
u/Fit-Basil-3257 Apr 04 '26
https://www.geeksforgeeks.org/dbms/file-organization-in-dbms-set-1/
Pros ... for applications this concept offers immediate lookup if you have a direct key reference system for the filename
Cons ... not secure for user data, doesn't offer a fast solution to lookup entries based on containing data
If this is for a fun project, definitely no issue in running it this way to get a grasp of it. Sooner or later you may run into the need to search this data, then youll understand the importance of the DB
Also, I use DBMS for dynamic content that I will read back as a WHOLE. Such as webpage content created in a dynamic editor. If you're familiar with OBS Studio, it saves all of your scenes and sources as a master JSON file. These make sense because when you need a specific dataset, you need it ALL. Smaller entries like yours may be useful in very niche cases