Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class User
- {
- var $username;
- var $password;
- var $full_name;
- var $email;
- public function save()
- {
- $prepared_statement = DB::getInstance()->prepare('INSERT INTO users (username, password, full_name, email) VALUES (?, ?, ?, ?)');
- $prepared_statement->execute(array($this->username, $this->password, $this->full_name, $this->email));
- }
- }
- // create betty
- $betty = new User;
- $betty->username = 'betty';
- $betty->password = '123';
- $betty->fullname = 'Sir Developsalot';
- $betty->email = 'test@test.com';
- $betty->save();
- // create bob
- $bob = new User;
- $bob->username = 'bob';
- $bob->password = '123';
- $bob->fullname = 'Sir Developsalot';
- $bob->email = 'test@test.com';
- $bob->save();
Add Comment
Please, Sign In to add comment