Guest User

Untitled

a guest
Jul 16th, 2018
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. <?php
  2.  
  3. class User
  4. {
  5.     var $username;
  6.     var $password;
  7.     var $full_name;
  8.     var $email;
  9.  
  10.     public function save()
  11.     {
  12.         $prepared_statement = DB::getInstance()->prepare('INSERT INTO users (username, password, full_name, email) VALUES (?, ?, ?, ?)');
  13.         $prepared_statement->execute(array($this->username, $this->password, $this->full_name, $this->email));
  14.     }
  15. }
  16.  
  17. // create betty
  18. $betty = new User;
  19. $betty->username = 'betty';
  20. $betty->password = '123';
  21. $betty->fullname = 'Sir Developsalot';
  22. $betty->email    = 'test@test.com';
  23. $betty->save();
  24.  
  25. // create bob
  26. $bob = new User;
  27. $bob->username = 'bob';
  28. $bob->password = '123';
  29. $bob->fullname = 'Sir Developsalot';
  30. $bob->email    = 'test@test.com';
  31. $bob->save();
Add Comment
Please, Sign In to add comment