Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class db {
- private $user = "7nowakm" ;
- private $pass = "pass7nowakm";
- private $host = "pascal.fis.agh.edu.pl";
- private $base = "7nowakm";
- private $coll = "??????";
- private $conn;
- private $dbase;
- private $collection;
- function __construct() {
- $this->conn = new MongoDB\Client("mongodb://{$this->user}:{$this->pass}@{$this->host}/{$this->base}");
- $this->collection = $this->conn->{$this->base}->{$this->coll};
- }
- function select() {
- $cursor = $this->collection->find();
- $table = iterator_to_array($cursor);
- return $table ;
- }
- function insert($user) {
- $ret = $this->collection->insertOne($user) ;
- return $ret;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement