Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
help me.., i'm blank :P
  • controller
    public function action_visitor()
    {
    if (Input::method() == 'POST')
    {

    $startdate = Input::post('startdate');
    $enddate= Input::post('enddate');

    $data['visitors'] = DB::query( "SELECT  `institution` , COUNT(  `visitor_id` ) AS  `jml` FROM  `visitor_count` WHERE  `checkin_date` >=  $startdate AND  `checkin_date` <=  $enddate GROUP BY  `institution`  ORDER BY  `jml` DESC ")->as_object()->execute();
    $this->template->title = "Visitor";
    $this->template->content = View::forge('admin/report/visitor,$data);

    }

    else{

    $this->template->title = "Visitor";
    $this->template->content = View::forge('admin/report/selectdate');

    }
    }


    View selectdate
    echo Form::open(array('action' => 'index.php/admin/report/visitor'));?>

    <fieldset>
    <?php echo Form::input('startdate', Input::post('startdate'), array('type'=>'date')); ?>
    <?php echo Form::input('enddate', Input::post('enddate'), array('type'=>'date')); ?>
    <?php echo Form::submit('submit', 'Find', array('class' => 'col-sm-2 btn btn-primary')); ?>
    </fieldset>
    <?php echo Form::close(); ?>


    View Visitor

    <?php if ($visitors): ?>

    <table class="table table-bordered table-hover " id="dataTables-example">
    <thead>
    <tr>
    <th>No</th>
    <th>Institution</th>
    <th>jml</th>
    </tr>
    </thead>
    <tbody>
    <?php 
    $num =1;
    foreach ($visitors as $item): ?> <tr>
    <td><?php echo $num;  ?></td>
    <td><?php echo $item->institution; ?></td>
    <td><?php echo $item->jml; $num++;?></td>


    </tr>
    <?php  endforeach; ?> </tbody>
    </table>


    <?php else: ?>
    <p>No data is found.</p>

    <?php endif; ?>




    I try to do query in SQL database directly tru Phpmyadmin, and it shows the result. 
    but if I do via form, selecting date and press submit button, there is no result displayed. 
    but not "No data is found"

    wich mean there is data, but I just can't display it.

    can you help to show me where did I make the mistake..., I'm blank now..
    tQ for your help.. :)



  • Enable the profiler in the config, enable database profiling in your db config, and check what SQL is generated, and how it differs from what you typed in manually.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion