For each user, you need to create a separate file (such as profile1.php , profile2.php , etc.)?
So that another registered user can view his profile.
1 answer
What are you, no, of course. PHP is the language in which this kind of action is prevented. This can be done in one file, but first decide on the access levels of type user / moderator / administrator.
When registering, for example, set the default user level and send everyone with the level "user" to a file such as "level_user.php", and administrators to "level_admin.php", you shouldn’t get everything into a single file for good, or you will get confused "if / else"
In general, familiarize yourself with OOP style PHP (object-oriented programming) and MVC (Model-View-Controller: model-view-controller).
And the user definition by id can be set via $ _GET, for example, in the link "/profile_user.php&user_id=65464654" "user_id" the key by which you can get the user id like this:
$user_id = $_GET['user_id']; and do not forget to process everything that comes through the $ _GET / $ _ POST / $ _ COOKIE global arrays, for example, digits for id lead to the same integer (int) and whatever it comes to, or it will be a whole digit or zero.
$user_id = (int)$_GET['user_id']; actually our variable "$ user_id" now has an id with which we access the database.
If I understand you correctly of course.
UserProfilestable in the database and storing information there looks, in my opinion, much better. - Regent