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 47
| <?php
class Ajaxsearch_model extends CI_Model
{
function fetch_data($km_max, $type, $carburant, $color, $mark)
{
$this->db->select("*");
$this->db->from("cars");
$this->db->like('visible', 1);
echo $carburant;
echo $color;
echo $mark;
echo $km_max;
echo $type;
if(($carburant != '') or ($type != '') or ($color != '') or ($mark != '') or ($km_max != ''))
{
echo "rechercheOK";
// echo "Testtesttest";
// echo $color;
// echo $mark;
// echo $carburant;
// $type = "hybride";
echo $type;
echo $mark;
$this->db->group_start();
$this->db->where('km >=', 14);
$this->db->like('type', $type);
$this->db->like('carburant', $carburant);
$this->db->like('mark', $mark);
// $this->db->like('price', $query);
$this->db->like('color', $color);
// $this->db->like('constructionMonth', $query);
// $this->db->like('constructionYear', $query);
// $this->db->like('cylindree', $query);
// $this->db->like('remark', $query);
// $this->db->like('photo', $query);
// $this->db->like('visible', $query);
$this->db->group_end();
}
return $this->db->get();
}
} |
Partager