Guest User

Untitled

a guest
Jul 26th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. Undefined private variables
  2. class data_base //helps handling permissins
  3. {
  4. private $host;
  5. private $user;
  6. private $password;
  7.  
  8. public function feed_data($hst, $usr, $pwd)
  9. {
  10. $host=$hst;
  11. $user=$usr;
  12. $password=$pwd;
  13. }
  14. public function get_data()
  15. {
  16. $info=array("host"=>" ", "user"=>" ", "password"=>" ");
  17. $info['host']=$host;
  18. $info['user']=$user;
  19. $info['password']=$password;
  20. return $info;
  21. }
  22. }
  23.  
  24. $user1=new data_base;
  25. $user2=new data_base;
  26.  
  27. $user1->feed_data("localhost", "root", ""); //enter details for user 1 here
  28. $user2->feed_data("", "", ""); //enter details for user 2 here
  29.  
  30. $perm_add=$user1->get_data();
  31. $perm_view=$user2->get_data();
  32.  
  33. $this->host;
  34. // instead of
  35. $host;
  36.  
  37. $info=array("host"=>" ", "user"=>" ", "password"=>" ");
  38. $info['host']=$host;
  39. $info['user']=$user;
  40. $info['password']=$password;
  41. return $info;
  42.  
  43. return array(
  44. 'host' => $this->host,
  45. 'user' => $this->user,
  46. 'password' => $this->password
  47. );
Add Comment
Please, Sign In to add comment