SELECT COUNT FROM car_car as car WHERE complited AND isSold AND isReSo

 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
SELECT COUNT(*) FROM
car_car as car
WHERE
complited=1 AND
isSold=0 AND isReSold=0 AND saleStart != 0
AND `car_id` LIKE 14159177 AND
1=1 AND `start`!='N'
TIME: 2.9271 sec.
---------
SELECT
*
FROM
car_car as car
WHERE
complited=1 AND
isSold=0 AND isReSold=0 AND saleStart != 0
AND `car_id` LIKE 14159177 AND
1=1 AND `start`!='N'
ORDER BY `saleStart` ASC
LIMIT 0, 10
[19.08.2009 14:21:57] Сергей: foreach($params as $key=>$value)
if($value !== '')
{
//`Value` parsing
$mark = is_array($value) && isset($value['mark']) && !empty($value['mark']) ? $value['mark'] : 'LIKE';
$v = is_array($value) && isset($value['text']) ? $value['text'] : $value;
$logic = is_array($value) && isset($value['logic']) && !empty($value['logic']) ? $value['logic'] : 'AND';
$field = is_array($value) && isset($value['field']) && !empty($value['field']) ? $value['field'] : $key;
$like = is_array($value) && isset($value['like']) && !empty($value['like']);
//Checking params
$v = $like ? "%{$v}%" : "{$v}";
$v = is_numeric($v) ? "{$v}" : "'{$v}'";
$field = strchr($field, '`') ? "{$field}" : "`{$field}`";
//Params
$param = "{$field} {$mark} {$v}";
$where = !empty($where) ? "{$where} {$logic} {$param}" : "$param";
}
if(!empty($where) && $usePrefix)
$where = "{$prefix} {$separator} {$where}";