adharshchottu / bambora_ecomm

Create an ecomm site and intergrate the payment with bambora payment api
4 stars 2 forks source link

Missing MYSQL entries - would be helpful #3

Open computeruteach opened 9 months ago

computeruteach commented 9 months ago

I created a table called users with username and password and that was as far as I got. Can you please let me know what the tables are in MYSQL? Are they only for the login.php and signup.php?

mishrakajal2200 commented 8 months ago

Creating a table named "users" with columns for username and password is a common practice when dealing with user authentication in MySQL databases. However, the structure of your database can expand beyond just a single table for user credentials. Here's a basic example of tables you might have in a simple authentication system:

Users Table: Stores user information such as username, password, and possibly other details. CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, email VARCHAR(255), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );

Sessions Table: If you want to implement session management, you might have a table to store active user sessions. CREATE TABLE sessions ( id INT AUTO_INCREMENT PRIMARY KEY, user_id INT, session_token VARCHAR(255), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE );

Roles Table: If you want to implement user roles (e.g., admin, regular user), you could have a table for roles. CREATE TABLE roles ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(50) NOT NULL );

UserRoles Table: A junction table to associate users with roles in a many-to-many relationship. CREATE TABLE user_roles ( user_id INT, role_id INT, PRIMARY KEY (user_id, role_id), FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE, FOREIGN KEY (role_id) REFERENCES roles(id) ON DELETE CASCADE );

computeruteach commented 8 months ago

Ok it's working, however there is no products. I am guessing I need to at least make a MYSQL table: "tblproduct" and "id" with "name" "$" and "price" ? I have found these references in products.php.