- <?PHP
- public function simple_multi_search($tablename, array $statemats, $options = array('limit' => 1))
- {
- $this->db_connection_test();
- $conditions = array();
- foreach($statemats as $fieldname => $value)
- {
- switch(substr($value, 0, 1)):
- case '>':
- $conditions[] = $fieldname." > '".substr($value, 1)."'";
- break;
- case '<':
- $conditions[] = $fieldname." < '".substr($value, 1)."'";
- break;
- default:
- switch(substr($value, 0, 2)):
- case '>=':
- $conditions[] = $fieldname." >= '".$value."'";
- break;
- case '<=':
- $conditions[] = $fieldname." <= '".$value."'";
- break;
- default:
- $conditions[] = $fieldname." = '".$value."'";
- endswitch;
- endswitch;
- }
- $query = $this->DB->simple_select($tablename, "*", implode(' AND ', $conditions), $options);
- if($query)
- {
- $cache = array();
- while($res = $this->db_fetch_array($query))
- {
- $cache[] = $res;
- }
- if(count($cache) > 0)
- return $cache;
- }
- return FALSE;
- }
Undefined
By: fruffl | Date: May 29 2010 15:29 | Format: None | Expires: never | Size: 1.17 KB | Hits: 843
Latest pastes
55 minutes ago
10 hours ago
1 days ago
2 days ago
2 days ago