Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

261
Visualizações
searchbox in codeigniter giving blank data

i have a simple searchbox in codeigniter, the controller is like below:

function searchtrack() {
    $this->load->model('excel_import_model');
    if(isset($_POST['submittrack'])) {
        $awb=$this->input->post('awb');
        $data['slt']= $this->excel_import_model->searchtrack($awb);
        $this->load->view("searchtrack",$data);
    }
}
}

the model is like below:

public function searchtrack($awbno) {
    $this->db->select('*');
    $this->db->where("awb", $awbno);
    $this->db->from('consignments');
    $query = $this->db->get();
    $result = $query->result();
    return $result;
}

and finally the display view:

<?php
  foreach($slt as $val){ echo $val->id; }
?>

however this not giving me any values, the post input is getting passed to the controller and the database column and all is fine, can anyone please tell me what is wrong in here thanks in advance

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

In your model, replace "where" with "like". "Where" look for specific data where "like" look for similar data.

public function searchtrack($awbno) {
    $this->db->select('*');
    $this->db->like("awb", $awbno, 'both');
    $this->db->from('consignments');
    $query = $this->db->get();
    $result = $query->result();
    return $result;
}

To control where the wildcard (%) placing in "like" method, a third parameter is used.

$this->db->like('awb', $awbno, 'before');    // Produces: WHERE `title` LIKE '%match' ESCAPE '!'
$this->db->like('awb', $awbno, 'after');     // Produces: WHERE `title` LIKE 'match%' ESCAPE '!'
$this->db->like('awb', $awbno, 'none');      // Produces: WHERE `title` LIKE 'match' ESCAPE '!'
$this->db->like('awb', $awbno, 'both');      // Produces: WHERE `title` LIKE '%match%' ESCAPE '!'
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda