Projekt

Obecné

Profil

« Předchozí | Další » 

Revize d9606f0d

Přidáno uživatelem Tomáš Pašek před asi 4 roky(ů)

Feature #8345 Implementce filterů dat - Server

Zobrazit rozdíly:

application/model/DB.php
23 23
    }
24 24

  
25 25
    // (C) RUN A SELECT QUERY
26
    function select($sql, $cond=null){
26
    function select($sql, $params){
27 27
        $result = false;
28 28
        try {
29 29
            $this->stmt = $this->pdo->prepare($sql);
30
            $this->stmt->execute($cond);
30
            if (array_key_exists("lemma", $params)) {
31
                $this->stmt->bindParam(':lemma',$params['lemma'], PDO::PARAM_STR);
32
            }
33
            if (array_key_exists("word", $params)) {
34
                $this->stmt->bindParam(':word',$params['word'], PDO::PARAM_STR);
35
            }
36
            if (array_key_exists("position1", $params)) {
37
                $this->stmt->bindParam(':position1',$params['position1'], PDO::PARAM_INT);
38
            }
39
            if (array_key_exists("position2", $params)) {
40
                $this->stmt->bindParam(':position2',$params['position2'], PDO::PARAM_INT);
41
            }
42
            if (array_key_exists("positiondetail", $params)) {
43
                $this->stmt->bindParam(':positiondetail',$params['positiondetail'], PDO::PARAM_INT);
44
            }
45
            if (array_key_exists("tag", $params)) {
46
                $this->stmt->bindParam(':tag',$params['tag'], PDO::PARAM_STR);
47
            }
48
            if (array_key_exists("tag", $params)) {
49
                $this->stmt->bindParam(':tag',$params['tag'], PDO::PARAM_STR);
50
            }
51
            if (array_key_exists("finished", $params)) {
52
                $this->stmt->bindParam(':finished',$params['finished']);
53
            }
54
            if (array_key_exists("manuscript", $params)) {
55
                for ($x = 0; $x < count($params["manuscript"]); $x += 1) {
56
                    $this->stmt->bindParam(':manuscript'.$x,$params["manuscript"][$x], PDO::PARAM_INT);
57
                }
58
            }
59
            $this->stmt->execute();
31 60
            $result = $this->stmt->fetchAll();
32 61
            return $result;
33 62
        } catch (Exception $ex) {
......
39 68

  
40 69
// (D) DATABASE SETTINGS - CHANGE TO YOUR OWN!
41 70
define('DB_HOST', 'localhost');
42
define('DB_NAME', 'dalimil1');
71
define('DB_NAME', 'dalimil2');
43 72
define('DB_CHARSET', 'utf8');
44 73
define('DB_USER', 'postgres');
45 74
define('DB_PASSWORD', 'a');

Také k dispozici: Unified diff