Codeigniter not showing data and page is not showing -
my codeigniter not showing page.
model
function get_all_district_circulars() { $this->db->select('*'); $this->db->from('district_circulars'); $this->db->where('status', 1); $this->db->order_by('id', 'desc'); $query = $this->db->get(); return $query->result(); } controller index function
public function index() { $dt['dist_circulars'] = $this->content_model->get_all_district_circulars(); $this->load->view('parts/top'); $this->load->view('parts/header'); $this->load->view('parts/nav'); $this->load->view('district_circulars', $dt); $this->load->view('parts/footer'); } view
<?php foreach($dist_circulars $dt_circulars){ ?> <tr> <td></td> </tr> <?php } ?> if delete foreach function, page displaying properly, if put it, page not loading , showing this site can’t reached , chrome console shows get http://localhost/anandadhara/district_circulars/ net::err_connection_reset
what should ?
update 1
my .htaccess follows
<ifmodule mod_rewrite.c> rewriteengine on rewritebase /anandadhara/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?/$1 [l,qsa] </ifmodule> i using wampserver 2.2
update 2
my file name district_circulars.php.
class:
class district_circulars extends ci_controller { public function __construct() { parent::__construct(); $this->load->model('content_model'); } another update
it works fine if display single result here.
<?php foreach($dist_circulars $dt_circulars){ ?> <tr> <td><?php echo $dt_circulars->id; ?></td> </tr> <?php } ?> but if show more 1 field here like...
<td><?php echo $dt_circulars->id; ?></td> <td><?php echo $dt_circulars->memo_no; ?></td> or if put 2 blank html tag here...
<td></td> <td></td> the page shows err_connection_reset , showing browser blank page connection_reset page , showing no data.
i cannot understand going on here.
model:
//need make public function if calling controller
public function get_all_district_circulars() { //simplify model call, use instead of return $this->db->select('*')->where('status', 1)->order_by('id', 'desc')->get('district_circulars')->result(); } view:
place if check , use php alternative syntax when in views http://php.net/manual/en/control-structures.alternative-syntax.php
<?php if(isset($dist_circulars)): ?> <?php foreach($dist_circulars $dt_circulars): ?> <tr> <td></td> </tr> <?php endforeach; ?> <?php endif; ?>
Comments
Post a Comment