Welcome Guest, Not a member yet? Register   Sign In
how to display database?
#1

[eluser]yudahebat[/eluser]
I have a model like this
Code:
class Crud extends Model
{
    function Crud()
    {
        parent::Model();
    }
    
/* PILIH DATA */

    function cetak_data()
    {
        $query = $this->db->query('SELECT * FROM reservasi WHERE tgl_pesan BETWEEN '. $this->input->post('dari_tgl').
        ' AND '.$this->input->post('sampai_tgl').'');
        return $query->result_array();
    }
}
controller like this
Code:
function cetak_data()
    {
        $data['css1']        = $this->css;
        $data['base']         = $this->base;
        $data['menu_adm']     = $this->menu;
        $data['myrobots']     = '<meta name="robots" content="noindex,nofollow">';
        $data['mywebtitle'] = 'mrputucar | Cetak Data';
        $data['pesans']     = $this->Crud->cetak_data();

        $this->load->view('cetak_data',$data);  
    }
and view file like this
Code:
<h1 style="color:#E7541A;">Data User</h1>
        <table width="925" border="0" cellpadding="0" cellspacing="0" class="tabel" >
        <tr>
            <td width="60" class="tabel"><p>TANGGAL</p></td>
            <td width="90" class="tabel"><p>ID</p></td>
            <td width="80" class="tabel"><p>ID USER</p></td>
            <td width="150" class="tabel"><p>BIAYA TOTAL</p></td>
        </tr>
        &lt;?php foreach($pesans as $pesan):?&gt;
        <tr>
            <td  class="tabel2" valign="top"><p>&lt;?= $pesan['tgl_pesan']?&gt;</p></td>
            <td  class="tabel2" valign="top"><p>&lt;?= $pesan['id']?&gt;</p></td>
            <td  class="tabel2" valign="top"><p>&lt;?= $pesan['id_user']?&gt;</p></td>
            <td  class="tabel2" valign="top"><p>&lt;?= $pesan['biaya_total']?&gt;</p></td>
        </tr>
        &lt;?php endforeach;?&gt;
        </table>

but its not shown the data to the view..
whats wrong??
#2

[eluser]Thorpe Obazee[/eluser]
[quote author="yudahebat" date="1244038399"]I have a model like this
Code:
class Crud extends Model
{
    function Crud()
    {
        parent::Model();
    }
    
/* PILIH DATA */

    function cetak_data()
    {
        $query = $this->db->query('SELECT * FROM reservasi WHERE tgl_pesan BETWEEN '. $this->input->post('dari_tgl').
        ' AND '.$this->input->post('sampai_tgl').'');
        return $query->result_array();
    }
}
controller like this
Code:
function cetak_data()
    {
        $data['css1']        = $this->css;
        $data['base']         = $this->base;
        $data['menu_adm']     = $this->menu;
        $data['myrobots']     = '&lt;meta name="robots" content="noindex,nofollow"&gt;';
        $data['mywebtitle'] = 'mrputucar | Cetak Data';
        $data['pesans']     = $this->Crud->cetak_data();

        $this->load->view('cetak_data',$data);  
    }
and view file like this
Code:
<h1 style="color:#E7541A;">Data User</h1>
        <table width="925" border="0" cellpadding="0" cellspacing="0" class="tabel" >
        <tr>
            <td width="60" class="tabel"><p>TANGGAL</p></td>
            <td width="90" class="tabel"><p>ID</p></td>
            <td width="80" class="tabel"><p>ID USER</p></td>
            <td width="150" class="tabel"><p>BIAYA TOTAL</p></td>
        </tr>
        &lt;?php foreach($pesans as $pesan):?&gt;
        <tr>
            <td  class="tabel2" valign="top"><p>&lt;?= $pesan['tgl_pesan']?&gt;</p></td>
            <td  class="tabel2" valign="top"><p>&lt;?= $pesan['id']?&gt;</p></td>
            <td  class="tabel2" valign="top"><p>&lt;?= $pesan['id_user']?&gt;</p></td>
            <td  class="tabel2" valign="top"><p>&lt;?= $pesan['biaya_total']?&gt;</p></td>
        </tr>
        &lt;?php endforeach;?&gt;
        </table>

but its not shown the data to the view..
whats wrong??[/quote]
Post originally from here: http://ellislab.com/forums/viewthread/119049/
#3

[eluser]Dam1an[/eluser]
[quote author="bargainph" date="1244038802"]
Post originally from here: http://ellislab.com/forums/viewthread/119049/[/quote]

I knew this looked farmiliar
#4

[eluser]Thorpe Obazee[/eluser]
I don't know the reason why people do this. Now, people could answer here or there which will create more confusion for the OP.




Theme © iAndrew 2016 - Forum software by © MyBB