<?php 

	class DbOperations{

		private $con; 

		function __construct(){

			require_once dirname(__FILE__).'/DbConnect.php';

			$db = new DbConnect();

			$this->con = $db->connect();

		}

		
		
         /**
     * Storing  cam
     */
    public function storeCam($camid, $description) {
    
        $stmt = $this->con->prepare("INSERT INTO cam(camid, description) VALUES(?,?)");
        $stmt->bind_param("ss", $camid, $description);
        $result = $stmt->execute();
        $stmt->close();
 
        // check for successful store
        if ($result) {
            $stmt = $this->con->prepare("SELECT * FROM cam WHERE camid = ?");
            $stmt->bind_param("s", $camid);
            $stmt->execute();
            $token = $stmt->get_result()->fetch_assoc();
            $stmt->close();
 
            return $token;
        } else {
            return false;
        }
           }
            
 
}