• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
time on the search results

#1
[eluser]zacksyah[/eluser]
how to show total & time on the search result like google?

This my codeigniter code
Controller
employee.php
Code:
<?php
    class Welcomee extends CI_Controller
    {
        function __construct(){
            parent::__construct();
        
            $this->load->model('m_welcome');
            $this->load->helper('html');
        }
        
        function index()
        {
            $data['tampilan']=$this->m_welcome->tampilan();
            $this->load->view('tampilan',$data);
        }
        
        function cari()
        {
            $data['tampilan']=$this->m_welcome->caridata();
            
            if($data['tampilan']==NULL)
            {
                echo "data tidak ada";
                echo anchor('welcomee','kembali');
                
            }  else {
                $this->load->view('tampilan',$data);
            }
        }
    }
?>

Model
m_welcome.php
Code:
<?php
    class M_welcome extends CI_Model
    {
        function tampilan()
        {
           //$this->db->from('pegawai');
           $query=$this->db->get('pegawai');
           return $query->result();
        }
        
        function caridata()
        {
            $c=$this->input->POST('cari');
            $this->db->like('nama',$c);
            $query=$this->db->get('pegawai');
            return $query->result();
        }
        
    }
?>

View
tampilan.php
Code:
<center>
<h3>Tabel data mahasiswa<h3>


<table border=1 >
<tr>
<td>ID</td>
<td>NIM</td>
<td>NAMA</td>
<td>TTL</td>
<td>ALAMAT</td>
<td>HP</td>
</tr>
&lt;?php foreach($tampilan as $row) : ?&gt;
<tr>
<td>&lt;?php echo $row->id; ?&gt;</td>
<td>&lt;?php echo $row->nip; ?&gt;</td>
<td>&lt;?php echo $row->nama; ?&gt;</td>
<td>&lt;?php echo $row->ttl; ?&gt;</td>
<td>&lt;?php echo $row->almt; ?&gt;</td>
<td>&lt;?php echo $row->hp; ?&gt;</td>
</tr>
&lt;?php endforeach; ?&gt;
</table>
<br>
&lt;form action="&lt;?php echo site_url();?&gt;/welcomee/cari" method=POST&gt;
    &lt;input type=text name=cari&gt;
    &lt;input type=submit value="cari"&gt;
    &lt;/input&gt;&lt;/form>
<a href="&lt;?php echo site_url();?&gt;/welcomee">Tampilkan Semua</a>

please help me thanks b4 ;-)


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.