Rev 141 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 141 | Rev 152 | ||
|---|---|---|---|
| Line 97... | Line 97... | ||
| 97 | $cleaned = implode($implode, $cleaned); |
97 | $cleaned = implode($implode, $cleaned); |
| 98 | } |
98 | } |
| 99 | return $cleaned; |
99 | return $cleaned; |
| 100 | } |
100 | } |
| 101 | 101 | ||
| - | 102 | public function db_query($query, $query_only = TRUE, $return_type = 'all', $assoc = TRUE) { |
|
| - | 103 | $db =& MDB2::connect($this->dsn); |
|
| - | 104 | $db_result =& $db->query($query); |
|
| - | 105 | if ($query_only) { |
|
| - | 106 | return TRUE; |
|
| - | 107 | } else { |
|
| - | 108 | switch (trim(strtolower($return_type))) { |
|
| - | 109 | case 'row': |
|
| - | 110 | if ($assoc) { |
|
| - | 111 | return $db_result->fetchRow(MDB2_FETCHMODE_ASSOC); |
|
| - | 112 | } else { |
|
| - | 113 | return $db_result->fetchRow(); |
|
| - | 114 | } |
|
| - | 115 | break; |
|
| - | 116 | case 'col': |
|
| - | 117 | return $db_result->fetchCol(); |
|
| - | 118 | break; |
|
| - | 119 | case 'all': |
|
| - | 120 | default: |
|
| - | 121 | if ($assoc) { |
|
| - | 122 | return $db_result->fetchAll(MDB2_FETCHMODE_ASSOC); |
|
| - | 123 | } else { |
|
| - | 124 | return $db_result->fetchAll(); |
|
| - | 125 | } |
|
| - | 126 | break; |
|
| - | 127 | } |
|
| - | 128 | } |
|
| - | 129 | } |
|
| - | 130 | ||
| 102 | /** |
131 | /** |
| 103 | * Checks $query_value against $ini_value to see a) if its a regex or csv match. |
132 | * Checks $query_value against $ini_value to see a) if its a regex or csv match. |
| 104 | * It will then return TRUE if it is a match or FALSE if not. |
133 | * It will then return TRUE if it is a match or FALSE if not. |
| 105 | * |
134 | * |
| 106 | * @param string $ini_value INI file value |
135 | * @param string $ini_value INI file value |