Hi,
I got a grid with four refined search fields. The grid runs ok with any zero, one or two different field selections (not values on a field but different selections).
Maybe a sample will be clearer:
Thi grid shows the content of a hardware devices table, with refined search over maker, owner, status, and device type. I can check oner or more "makers" and one or more "owners", no problem.
Buf if I check one "device type" or "status" value, the SQL sentence for the search is erroneous.
I think I've found the problem in spdbgrid.php, in the __xexec function, when processing the cmd "rsearchr", around line 619, I found this code:
if($whereex=='') {
if($where != '') { $whereex.='('.$where.')'; }
$where='';
} else {
if($where != '') { $whereex.=' and ('.$where.')';
}
I corrected this way:
if($whereex=='') {
if($where != '') { $whereex.='('.$where.')'; }
} else {
if($where != '') { $whereex.=' and ('.$where.')';
}
$where='';
Summary: the $where variable is reinitialized only on the first refined search field, not the subsecuent ones, so if the refined search includes three or more fields, the where is incorrectly formed.
Setting it to blank outside the IF take care of that (is always set to blank).
In my tests is working ok.