Multilevel screening $name =$_get[pid]; $brand =$_get[theme]; $carage =$_get[price]; Echo $carage; if ($name = "Pump Car" and $brand = "31") {$handmebuyinfo =m ("Handmebuyinfo"); $map [' name ']= $name; $map [' Brand ']= $brand; $map [' Carage ']= $carage; $row = $handmebuyinfo->where ($map)->select (); Dump ($row); if ($name = = "or $brand = =" or $carage = = ") { $handmebuyinfo =m ("Handmebuyinfo"); $map [' name ']= $name; $map [' Brand ']= $brand; $map [' Carage ']= $carage; $map [' _logic '] = ' OR '; $row = $handmebuyinfo->where ($map)->select (); Dump ($row); }
Reply to discussion (solution)
Your screening is a relationship with (and)
If there is more than one choice within the group, then the group is or (or) the relationship, such as the simultaneous selection of the pump Truck and mixer truck
But you don't have that demand right now.
You use ORM, so the assembly work is done by ORM.
You just have to ensure that you do not pass NULL parameters to it $_get = Array_diff ($_get, Array ("));
It is best to pass in the same name as the corresponding field, so that you do not need to program the corresponding data.
Like TP with a name mapping function, you can use
Your screening is a relationship with (and)
If there is more than one choice within the group, then the group is or (or) the relationship, such as the simultaneous selection of the pump Truck and mixer truck
But you don't have that demand right now.
You use ORM, so the assembly work is done by ORM.
You just have to ensure that you do not pass NULL parameters to it $_get = Array_diff ($_get, Array ("));
It is best to pass in the same name as the corresponding field, so that you do not need to program the corresponding data.
Like TP with a name mapping function, you can use
Compare the difference set in the array a little bit clear, can you give me an example to see?
$a = Array ( ' a ' = = 1, ' b ' = = ', ' c ' = = 0,);p rint_r (Array_diff ($a, Array (")));p Rint_r (Array_diff ( $a, Array (", 0)));
Array ( [A] = 1 [c] + 0) Array ( [A] = 1)
This will not require if ($name = = ") to judge the
$a = Array ( ' a ' = = 1, ' b ' = = ', ' c ' = = 0,);p rint_r (Array_diff ($a, Array (")));p Rint_r (Array_diff ( $a, Array (", 0)));
Array ( [A] = 1 [c] + 0) Array ( [A] = 1)
This will not require if ($name = = ") to judge the
I got it, it started with
$map [' name ']= ' Null ';
$map [' Brand ']= $map [BRAND];
$map [' Carage ']= $map [carage];
$row = $handmebuyinfo->where ($map)->select ();
Dump ($row), quick query query does not have the data, the original is here the face value is not allowed to empty, so remove these direct assignment query is no problem.