Revize 2eab68b9
Přidáno uživatelem Tomáš Pašek před téměř 4 roky(ů)
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("manuscript", $params)) { |
|
49 |
for ($x = 0; $x < count($params["manuscript"]); $x += 1) { |
|
50 |
$this->stmt->bindParam(':manuscript'.$x,$params["manuscript"][$x], PDO::PARAM_INT); |
|
51 |
} |
|
52 |
} |
|
53 |
$this->stmt->execute(); |
|
31 | 54 |
$result = $this->stmt->fetchAll(); |
32 | 55 |
return $result; |
33 | 56 |
} catch (Exception $ex) { |
... | ... | |
39 | 62 |
|
40 | 63 |
// (D) DATABASE SETTINGS - CHANGE TO YOUR OWN! |
41 | 64 |
define('DB_HOST', 'localhost'); |
42 |
define('DB_NAME', 'dalimil1');
|
|
65 |
define('DB_NAME', 'dalimil2');
|
|
43 | 66 |
define('DB_CHARSET', 'utf8'); |
44 | 67 |
define('DB_USER', 'postgres'); |
45 | 68 |
define('DB_PASSWORD', 'a'); |
Také k dispozici: Unified diff
Feature #8345 Implementce filterů dat - Server
vytvoření filtrů