public static function delete($id)
 {
     $pdo = DbConnect::connect();
     $sql = "DELETE from abteilung WHERE id=:id";
     $stmt = $pdo->prepare($sql);
     $stmt->execute([':id' => $id]);
 }
 function __construct()
 {
     require_once 'dbconn.php';
     // CONNESSIONE
     $db = new DbConnect();
     $this->conn = $db->connect();
 }
 function __construct()
 {
     // opening db connection
     $db = new DbConnect();
     $this->conn = $db->connect();
     //$this->echoAllConstituentNames();
 }
Exemple #4
0
 function __construct()
 {
     require_once dirname(__FILE__) . '/DbConnect.php';
     // Abrimos la conexxion a la BD
     $db = new DbConnect();
     $this->conn = $db->connect();
 }
Exemple #5
0
 function __construct()
 {
     require_once dirname(__FILE__) . '/DbConnect.php';
     // opening db connection
     $db = new DbConnect();
     $this->conn = $db->connect();
 }
Exemple #6
0
 function __construct()
 {
     $this->columns = array();
     require_once 'config/DbConnect.php';
     // opening db connection
     $db = new DbConnect();
     $this->conn = $db->connect();
 }
Exemple #7
0
 function __construct()
 {
     require_once dirname(__FILE__) . '/db_connect.php';
     require_once dirname(__FILE__) . '/mail/class.phpmailer.php';
     require_once dirname(__FILE__) . '/mail/class.smtp.php';
     // opening db connection
     $db = new DbConnect();
     $this->conn = $db->connect();
 }
 function __construct()
 {
     require_once dirname(__FILE__) . '/DbConnect.php';
     //open new database
     try {
         $db = new DbConnect();
         //instantiate the DbConnect class
         $this->conn = $db->connect();
     } catch (PDOException $ex) {
         $this::dbConnectError($ex->getCode());
     }
 }
 public function getSubcategory($id)
 {
     $connection = new DbConnect();
     $pdo = $connection->connect();
     $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     $query = "select * from subcategories\n                  where id = :id";
     $stmt = $pdo->prepare($query);
     $stmt->bindParam(':id', $id);
     $stmt->setFetchMode(PDO::FETCH_CLASS, 'Subcategory');
     $stmt->execute();
     $subcategory = $stmt->fetch();
     return $subcategory;
     //return $this;
 }
Exemple #10
0
 function __construct()
 {
     require_once dirname(__FILE__) . '/DbConnect.php';
     //open new database connection
     try {
         $db = new DbConnect();
         //instantiate the DbConnect class
         $this->conn = $db->connect();
     } catch (Exception $ex) {
         $this::dbConnectError($ex->getCode());
         exit;
         //unconditionally stop processing
     }
 }
 function __construct()
 {
     require_once dirname(__FILE__) . '/DbConnect.php';
     // abriendo conexión
     $db = new DbConnect();
     $this->conn = $db->connect();
     session_start();
     if (isset($_SESSION['user'])) {
         $user_logged_in = true;
     }
     if (isset($_SESSION['copisteria'])) {
         $copisteria_logged_in = true;
     }
 }
 public static function getAll()
 {
     $pdo = DbConnect::connect();
     $sql = "SELECT mit.vorname vorname, mit.nachname nachname, abt.name abteilung, CONCAT(vor.vorname, ' ', vor.nachname) vorgesetzter\r\n                FROM abteilung abt\r\n                LEFT JOIN mitarbeiter mit ON mit.abteilung_id=abt.id\r\n                LEFT JOIN mitarbeiter vor ON mit.vorgesetzter_id=vor.id";
     $stmt = $pdo->prepare($sql);
     $stmt->execute();
     $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
     //        echo '<pre>';
     //        print_r($rows);
     //        echo '</pre>';
     //        die();
     //        echo 'Start';
     return $rows;
 }
 public static function getAll()
 {
     $pdo = DbConnect::connect();
     $sql = "SELECT CONCAT(her.name, ' ', a.name, ' ', a.kennzeichen) Fahrzeug, CONCAT(mit.vorname, ' ', mit.nachname) Ausleiher, aus.von Von, aus.bis Bis\r\n                FROM auto a, hersteller her, mitarbeiter mit, ausleihe aus\r\n                WHERE aus.auto_id=a.id AND a.hersteller_id=her.id AND aus.mitarbeiter_id=mit.id;";
     $stmt = $pdo->prepare($sql);
     $stmt->execute();
     $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
     //        echo '<pre>';
     //        print_r($rows);
     //        echo '</pre>';
     //        die();
     //        echo 'Start';
     return $rows;
 }
 public static function getAll()
 {
     $pdo = DbConnect::connect();
     $sql = "SELECT projekt.name Projektname, CONCAT(mitarbeiter.vorname,' ', mitarbeiter.nachname) Mitarbeiter, HOUR(TIMEDIFF(projektmitarbeiter.von, projektmitarbeiter.bis)) Stunden \r\n                FROM projekt, projektmitarbeiter, mitarbeiter \r\n                WHERE projektmitarbeiter.projekt_id=projekt.id AND mitarbeiter.id = projektmitarbeiter.mitarbeiter_id;";
     $stmt = $pdo->prepare($sql);
     $stmt->execute();
     $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
     //        echo '<pre>';
     //        print_r($rows);
     //        echo '</pre>';
     //        die();
     //        echo 'Start';
     return $rows;
 }
 public static function getAll()
 {
     $pdo = DbConnect::connect();
     $sql = "SELECT abt.name Abteilung, CONCAT(mit.vorname, ' ', mit.nachname) Ausleiher, aus.von Von, aus.bis Bis\n                FROM abteilung abt, mitarbeiter mit, ausleihe aus\n                WHERE mit.abteilung_id=abt.id AND aus.mitarbeiter_id=mit.id;";
     $stmt = $pdo->prepare($sql);
     $stmt->execute();
     $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
     //        echo '<pre>';
     //        print_r($rows);
     //        echo '</pre>';
     //        die();
     //        echo 'Start';
     return $rows;
 }
 public function UpdateSubcategoryState($subcategoryId, $isOffline)
 {
     $connection = new DbConnect();
     $pdo = $connection->connect();
     $query = "UPDATE subcategories\n                    SET offline = :offline\n                    WHERE id = :id";
     $stmt = $pdo->prepare($query);
     $stmt->bindParam(":offline", $isOffline);
     $stmt->bindParam(":id", $subcategoryId);
     $stmt->execute();
     return $stmt->errorInfo();
 }
Exemple #17
0
<?php

require '../libs/Slim/Slim.php';
require_once __DIR__ . '/include/database.class.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
// connecting to db
$db = new DbConnect();
$conn = $db->connect();
// get
$app->get('/girls', function () use($app, $conn) {
    $page = $app->request->get('p');
    if ($page == '' || !is_numeric($page)) {
        $page = 0;
    }
    var_dump($name);
});
// put
$app->get('/girls/:girlid', function ($girlid) use($app, $conn) {
    if ($girlid == '' || !is_numeric($girlid)) {
        $response["code"] = 0;
        $response["msg"] = "oops, you need to tell me the girl's id";
        exit(json_encode($response));
    }
    // let the girl's star_count + 1
    $result = $conn->query("UPDATE meizi set star_count = star_count + 1 WHERE id = {$girlid}");
    if ($result) {
        // success
        $response["code"] = 1;
        $response["msg"] = "success";
        echo json_encode($response);
 public static function delete($id)
 {
     $pdo = DbConnect::connect();
     $sql = "delete from projektmitarbeiter WHERE id=:id";
     $stmt = $pdo->prepare($sql);
     $stmt->execute([':id' => $id]);
 }
 public static function markAsRead($msgId)
 {
     $connection = new DbConnect();
     $pdo = $connection->connect();
     $query = "UPDATE direct_message SET isRead = 1 WHERE id = :msgId";
     $stmt = $pdo->prepare($query);
     $stmt->bindParam(':msgId', $msgId);
     $stmt->execute();
 }
Exemple #20
0
 public static function delete($id)
 {
     $pdo = DbConnect::connect();
     $sql = "delete from ausleihe WHERE id=:id";
     $stmt = $pdo->prepare($sql);
     $stmt->execute([':id' => $id]);
 }
 public function GetIsSubCategoryDisabled($subcategoryId)
 {
     //Check if subcategory disabled:
     $connection = new DbConnect();
     $pdo = $connection->connect();
     $query = "SELECT category_id, offline from subcategories\n                    WHERE id = :id";
     $stmt = $pdo->prepare($query);
     $stmt->bindParam('id', $subcategoryId);
     $stmt->execute();
     $result = $stmt->fetch();
     if ($result) {
         if ($result['offline'] == true) {
             return true;
         } else {
             //Subcategory not disabled - check parent category enabled or not
             $query = "SELECT offline from categories\n                    WHERE id = :id";
             $stmt = $pdo->prepare($query);
             $stmt->bindParam('id', $result['category_id']);
             $stmt->execute();
             $result = $stmt->fetch();
             return $result['offline'];
         }
     } else {
         return null;
     }
 }
Exemple #22
0
 function __construct()
 {
     require_once dirname(__FILE__) . '/' . '../utils/DbConnect.php';
     $db = new DbConnect();
     $this->conn = $db->connect();
 }
Exemple #23
0
 public function checkIfBannedOrDeleted()
 {
     $connection = new DbConnect();
     $pdo = $connection->connect();
     if ($this->email !== '') {
         $identify = $this->email;
         $query = "SELECT is_banned\n                FROM users\n                WHERE email = :identify";
     } else {
         $identify = $this->username;
         $query = "SELECT is_banned\n                FROM users\n                WHERE username = :identify";
     }
     $stmt = $pdo->prepare($query);
     $stmt->bindParam(':identify', $identify);
     $stmt->execute();
     $status = $stmt->fetch(PDO::FETCH_OBJ);
     if ($status == null) {
         return false;
     }
     if ($status->is_banned == 0) {
         return false;
     } else {
         return true;
     }
 }
 /**
  * constructor
  */
 function __construct()
 {
     require_once 'DbConnect.php';
     $db = new DbConnect();
     $this->_conn = $db->connect();
 }
Exemple #25
0
 function __construct()
 {
     // opening db connection
     $db = new DbConnect();
     $this->conn = $db->connect();
 }
Exemple #26
0
 public function updatePassword($id, $password)
 {
     $password = password_hash($password, PASSWORD_DEFAULT);
     $connection = new DbConnect();
     $pdo = $connection->connect();
     $query = "UPDATE users\n                        SET password = :password\n                        WHERE id = :id";
     $stmt = $pdo->prepare($query);
     $stmt->bindParam(':id', $id);
     $stmt->bindParam(':password', $password);
     $stmt->execute();
     return $stmt->errorCode();
 }