Welcome Guest, Not a member yet? Register   Sign In
How to Sorting my Tables Fields?
#1

[eluser]Jauhari[/eluser]
I am newbie in CI and I really enjoy with this framework.

I have question about how to sort or add where condition.
This is my detail problem.

I was made some tabular data with some field, example name and email. then I was succesfully display my tabular data on my view.

My Question is, how to sorting my data? on my tables I have some date added. And I want make simple form, where I can input some value (example input data added on 2/2/2008 only) and my tabular data automatically will change to current data on 2/2/2008 only.

How to do that? please help me.

I was try add this code on my controllers
Code:
function address() {
    
        $this->load->helper('form');    
        $this->db->select('nama,email,date');
        $this->db->where('date','$date');        
        $this->db->from('address');
        $data['query'] = $this->db->get();
        
        $this->load->view('address', $data);
        }

And code on my Views
Code:
<form action="" method="POST">
        <?php
        $datas = array(
              'name'        => 'date',
              'id'          => 'date',
              'value'       => '8',
              'maxlength'   => '100',
              'size'        => '50',
              'style'       => 'yellow',
            );

$date = form_input($datas);
echo $date;
        ?>

                <button type="submit" class="button positive">
          Submit
                </button>
        &lt;/form&gt;

<table class="data">
<tr class="head">
    <th id="nid" rowspan="2" scope="col">No.</th>
    <th id="nper" rowspan="2" scope="col">Name</th>
    <th rowspan="2" scope="col">Email</th>
</tr>


&lt;?php
$i = 1;
if ($query->num_rows() > 0):
    foreach ($query->result() as $row):
?&gt;
<tr class="&lt;?php if($i%2 == '0'): echo "alt"; else: echo "row"; endif; ?&gt;">
    <td class="td-center">&lt;?php echo $i;$i++;?&gt;</td>
    <td class="td-center">&lt;?php echo $row->name;?&gt;</td>
    <td class="td-center">&lt;?php echo $row->email; ?&gt;</td>
</tr>
&lt;?php
    endforeach;
endif;
?&gt;    
</table>

But my sorting doesn't work Sad

Please Help Me


Messages In This Thread
How to Sorting my Tables Fields? - by El Forum - 03-08-2008, 11:49 AM
How to Sorting my Tables Fields? - by El Forum - 03-08-2008, 04:41 PM
How to Sorting my Tables Fields? - by El Forum - 03-08-2008, 05:38 PM
How to Sorting my Tables Fields? - by El Forum - 03-09-2008, 10:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB