Hi,
I'm pretty new to PHP, having only written code for one web site. I'm planning my next project and in this project there will be a set of users who will be registered by an "admin" user. The admin may add or delete new users through time. Each user will have account information and, of course, a password and username.
The problem is, I'm not clear on what is the best way to establish users of a website with PHP. Is one of the following approaches cleaner or is there some other suggestion you can offer me?
1) Using PHP to send the SQL statement "CREATE USER <user_name> PASSWORD <password>" to create my users for my MySQL db
. . . or . . .
2) Creating in my MySQL db a table (e.g. Table "Users") for storing new users, their passwords, etc.
I'm not clear yet on how to best work with multiple users.
Thanks in Advance,
J.T.
Create new users with "CREATE USERS" or in a table
Moderator: General Moderators
You want to create a table called users so that you can programatically give them access to parts of your application.
When you create a user with CREATE USER in mysql it only controls what access that user has to individual tables and sql statements. Usually you will have one database user for your application that gets used throughout your application to create database connections and nothing else.
When you create a user with CREATE USER in mysql it only controls what access that user has to individual tables and sql statements. Usually you will have one database user for your application that gets used throughout your application to create database connections and nothing else.