TblMember.class.php 2.53 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/**
 * @author GTFW CRUD Generator 
 */
 
class TblMember extends Database
{

    public function __construct($connectionNumber = 0)
    {
        parent::__construct($connectionNumber);
        $this->LoadSql('module/tbl.member/business/mysqlt/tblmember.sql.php');
        $this->SetDebugOn();
    }

    public function countTblMember($filter)
    {
        if (is_array($filter))
            extract($filter);
        $str = '';
        
        if (!empty($name)) {
            $str .= " AND LOWER(member_name) LIKE('%$name%')";
        }
        if (!empty($job)) {
            $str .= " AND LOWER(member_job) LIKE('%$job%')";
        }
        if (!empty($address)) {
            $str .= " AND LOWER(member_address) LIKE('%$address%')";
        }
        $query = $this->mSqlQueries['count_tblmember'];
        $query = str_replace('--search--', $str, $query);
        $result = $this->Open($query, array());
        return $result[0]['total'];
    }

    public function getTblMember($filter)
    {
        if (is_array($filter))
            extract($filter);
        $str = '';
        
        if (!empty($name)) {
            $str .= " AND LOWER(member_name) LIKE('%$name%')";
        }
        if (!empty($job)) {
            $str .= " AND LOWER(member_job) LIKE('%$job%')";
        }
        if (!empty($address)) {
            $str .= " AND LOWER(member_address) LIKE('%$address%')";
        }
        $limit = '';
        if (!empty($display)) {
            $limit = "LIMIT $start, $display";   
        }
        $query = $this->mSqlQueries['get_tblmember'];
        $query = str_replace('--search--', $str, $query);
        $query = str_replace('--limit--', $limit, $query);
        $result = $this->Open(stripslashes($query), array());
        return $result;

    }

    public function getDetailTblMember($id)
    {
        $result = $this->Open($this->mSqlQueries['get_detail_tblmember'], array($id));
        if ($result) {
            return $result[0];
        }
    }
    
    public function insertTblMember($params)
    {
        return $this->Execute($this->mSqlQueries['insert_tblmember'], $params);
    }
    
    public function updateTblMember($params)
    {
        return $this->Execute($this->mSqlQueries['update_tblmember'], $params);
    }
    
    public function deleteTblMember($id)
    {
        return $this->Execute($this->mSqlQueries['delete_tblmember'], array($id));
    }
    
    public function listTblMember()
    {
        return $this->Open($this->mSqlQueries['list_tblmember'], array());
    }
}

// End of file TblMember.class.php