Freddy444 / Songrating-Freddy.Max

MIT License
0 stars 0 forks source link

issue#45-usermodel #92

Closed Freddy444 closed 10 months ago

Freddy444 commented 10 months ago

This method retrieves user information (specifically, the username and password) from the database based on the provided username. It uses the select method from the Database class, passing a SQL query and an array of parameters.

The SQL query selects the username and password from the users table where the username matches the provided parameter. The method returns an array with the result of the database query or false if the query fails. createUser Method:

This method is responsible for creating a new user in the database. It takes two parameters: $username (the username of the new user) and $hashedPassword (the hashed password of the new user). It prepares an SQL query to insert a new row into the users table with the provided username and hashed password. It uses the mysqli_prepare function to prepare the SQL statement and then binds the parameters using mysqli_stmt_bind_param. The method returns true if the user is created successfully (based on the result of mysqli_stmt_execute) and false otherwise. Class Structure:

The class UserModel extends the Database class, indicating that it inherits properties and methods from the Database class. The Database class likely contains methods for database connections and general database operations.