Cheetah
modules
cheetah
quotes
classes
ChQuotesDb.php
Go to the documentation of this file.
1
<?
php
2
8
require_once( CH_DIRECTORY_PATH_CLASSES .
'ChWsbModuleDb.php'
);
9
10
define(
'CH_QUOTES_TABLE'
,
'ch_quotes_units'
);
11
12
/*
13
* Quotes module Data
14
*/
15
class
ChQuotesDb
extends
ChWsbModuleDb
16
{
17
var
$_oConfig
;
18
/*
19
* Constructor.
20
*/
21
function
__construct
(&$oConfig)
22
{
23
parent::__construct();
24
25
$this->_oConfig = $oConfig;
26
}
27
28
function
getRandomQuote
()
29
{
30
return
$this->
getRow
(
"SELECT `Text`, `Author` FROM `"
.
CH_QUOTES_TABLE
.
"` ORDER BY RAND() LIMIT 1"
);
31
}
32
function
getQuote
($iID)
33
{
34
return
$this->
getRow
(
"SELECT * FROM `"
.
CH_QUOTES_TABLE
.
"` WHERE `ID`= ? LIMIT 1"
, [$iID]);
35
}
36
function
getAllQuotes
()
37
{
38
return
$this->
getAll
(
"SELECT * FROM `"
.
CH_QUOTES_TABLE
.
"`"
);
39
}
40
function
deleteUnit
($iID)
41
{
42
return
$this->
query
(
"DELETE FROM `"
.
CH_QUOTES_TABLE
.
"` WHERE `ID`= ? LIMIT 1"
, [$iID]);
43
}
44
}
ChQuotesDb\deleteUnit
deleteUnit($iID)
Definition:
ChQuotesDb.php:40
php
ChWsbModuleDb
Definition:
ChWsbModuleDb.php:12
ChWsbDb\getAll
getAll($sQuery, $aBindings=[], $iFetchType=PDO::FETCH_ASSOC)
Definition:
ChWsbDb.php:206
ChQuotesDb\getAllQuotes
getAllQuotes()
Definition:
ChQuotesDb.php:36
ChWsbDb\getRow
getRow($sQuery, $aBindings=[], $iFetchStyle=PDO::FETCH_ASSOC)
Definition:
ChWsbDb.php:225
ChWsbDb\query
query($sQuery, $aBindings=[])
Definition:
ChWsbDb.php:386
ChQuotesDb\getQuote
getQuote($iID)
Definition:
ChQuotesDb.php:32
ChQuotesDb\__construct
__construct(&$oConfig)
Definition:
ChQuotesDb.php:21
ChQuotesDb\$_oConfig
$_oConfig
Definition:
ChQuotesDb.php:17
CH_QUOTES_TABLE
const CH_QUOTES_TABLE
Definition:
ChQuotesDb.php:10
ChQuotesDb\getRandomQuote
getRandomQuote()
Definition:
ChQuotesDb.php:28
ChQuotesDb
Definition:
ChQuotesDb.php:16
Generated by
1.8.20