how to display database? - El Forum - 06-03-2009
[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>
<?php foreach($pesans as $pesan):?>
<tr>
<td class="tabel2" valign="top"><p><?= $pesan['tgl_pesan']?></p></td>
<td class="tabel2" valign="top"><p><?= $pesan['id']?></p></td>
<td class="tabel2" valign="top"><p><?= $pesan['id_user']?></p></td>
<td class="tabel2" valign="top"><p><?= $pesan['biaya_total']?></p></td>
</tr>
<?php endforeach;?>
</table>
but its not shown the data to the view..
whats wrong??
how to display database? - El Forum - 06-03-2009
[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'] = '<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>
<?php foreach($pesans as $pesan):?>
<tr>
<td class="tabel2" valign="top"><p><?= $pesan['tgl_pesan']?></p></td>
<td class="tabel2" valign="top"><p><?= $pesan['id']?></p></td>
<td class="tabel2" valign="top"><p><?= $pesan['id_user']?></p></td>
<td class="tabel2" valign="top"><p><?= $pesan['biaya_total']?></p></td>
</tr>
<?php endforeach;?>
</table>
but its not shown the data to the view..
whats wrong??[/quote]
Post originally from here: http://ellislab.com/forums/viewthread/119049/
how to display database? - El Forum - 06-03-2009
[eluser]Dam1an[/eluser]
[quote author="bargainph" date="1244038802"]
Post originally from here: http://ellislab.com/forums/viewthread/119049/[/quote]
I knew this looked farmiliar
how to display database? - El Forum - 06-03-2009
[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.
|