Guest User

Untitled

a guest
Dec 12th, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. <?php
  2. require "database.class.php";
  3. class Users
  4. {
  5.  
  6. private $con;
  7. public function __construct()
  8. {
  9.  
  10. //en $this->con tenemos la conexión con la bd pruebas
  11. $this->con = new Database();
  12.  
  13. }
  14.  
  15. //obtenemos usuarios de una tabla con postgreSql
  16. public function getUsers()
  17. {
  18.  
  19. try{
  20.  
  21. $query = $this->con->prepare('SELECT * FROM res_partner');
  22. $query->execute();
  23. $this->con->close_con();
  24. return $query->fetchAll();
  25.  
  26. } catch(PDOException $e) {
  27.  
  28. echo $e->getMessage();
  29.  
  30. }
  31.  
  32. }
  33.  
  34. Users::getUsers();
  35.  
  36. }
  37.  
  38. <?php
  39. $host='------';
  40. $db = 'DiiNLAB';
  41. $username = 'odoo';
  42. $password = '--';
Add Comment
Please, Sign In to add comment