Exemplo n.º 1
0
Arquivo: Step.php Projeto: Quadrosh/NS
 public static function findByExID($id)
 {
     $db = \Qh\Db_lo::instance();
     $arr = [':id' => $id];
     $sql = 'SELECT * FROM steps ' . ' WHERE exercise_id = :id ORDER BY step_number ASC';
     try {
         $send2base = $db->queryObj($sql, self::class, $arr);
         return $send2base;
     } catch (\PDOException $exception) {
         throw new \App\Exceptions\Db($exception->getMessage());
     }
 }
Exemplo n.º 2
0
 public function getFullById($id)
 {
     $db = \Qh\Db_lo::instance();
     $getSteps = Step::findByExID($id);
     $arr = [':id' => $id];
     $sql = 'SELECT * FROM ' . static::TABLE . ' WHERE id = :id';
     try {
         $send2base = $db->queryObj($sql, static::class, $arr);
         if ([] !== $send2base) {
             $send2base[0]->ex_steps = $getSteps;
             return $send2base[0];
         } else {
             return false;
         }
     } catch (\PDOException $exception) {
         throw new \App\Exceptions\Db($exception->getMessage());
     }
 }
Exemplo n.º 3
0
 public function save()
 {
     $id = $this->id;
     $db = \Qh\Db_lo::instance();
     $sql = 'SELECT id FROM ' . static::TABLE;
     $arr = [];
     $goto = $db->queryArr($sql, $arr);
     $id_data = [];
     $id_exist = FALSE;
     foreach ($goto as $fieldname => $value) {
         $id_data[] = $value['id'];
         if ($id == $value['id']) {
             $id_exist = TRUE;
         }
     }
     if (FALSE == $id_exist) {
         $res = $this->insert();
         return $res;
     } else {
         $this->update($id);
         return 'обновлено с ID=' . $this->id;
     }
 }
Exemplo n.º 4
0
<?php

require __DIR__ . '/autoload.php';
// $controller = !empty($_GET['cont']) ? $_GET['cont']: 'ex';
// $action = !empty($_GET['act']) ? $_GET['act']: '2';
$db = \Qh\Db_lo::instance();
// $pdo = $db->getPDO();
// $author = new Qh\Controllers\Auth;
var_dump($db);
die;
$ns = $author->action('Register');
// $db =  \Qh\DbU::instance();
// $pdo = $db->getPDO();
// $auth = new Delight\Auth\Auth($pdo);
// var_dump($auth);
// $auth = new Delight\Auth\Auth($db);
// $chek = new Delight\Http\ResponseHeader();
// $chek =  Delight\Http\ResponseHeader::add();
// $ex = new Qh\Models\Exercise();
// $getAll = $ex->findAll();
// $getid = $ex->getFullById('2');