diff options
Diffstat (limited to 'models/database.php')
| -rw-r--r-- | models/database.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/models/database.php b/models/database.php index ad0c574..c8123ad 100644 --- a/models/database.php +++ b/models/database.php @@ -23,10 +23,14 @@ class User { return $query->fetch(); } - static function create(string $Username, string $Password, string $Role) { + static function create(string $Username, string $Password, string $Role) : int { $conn = connect(); $query = $conn->query("INSERT INTO Users (Username, Password, Role) VALUES (\"$Username\", \"$Password\", \"$Role\")"); + + // NOTE: If we ever insert more than one values, lastInsertId will returne the first id + $id = $conn->lastInsertId(); $conn = null; + return $id; } static function get_all() : array { |
