2
By clicking on the page link the same returns me a NOT FOUND.
<div class="scroll">
<table class="table table-hover" id="myTable">
<thead>
<tr>
<th><b>Nome</b></th>
<th><b>Email</b></th>
<td><b>Telefone</b></td>
<td><b>Cidade</b></td>
<td><b>PR</b></td>
</tr>
</thead>
<tbody>
<?php foreach ($results as $data) : ?>
<td><?= $data->nomeCliente ?></td>
<td><?= $data->emailCliente ?></td>
<td><?= $data->telefoneCliente ?></td>
<td><?= $data->cidadeCliente ?></td>
<td><?= $data->estadoCliente ?></td>
<td>
<a ><i class="glyphicon glyphicon-trash" title="Apagar" onclick="modalDelete()"></i></a>
</td>
<td>
<a href="index.php"><i class="glyphicon glyphicon-edit" title="Editar".></i></a>
</td>
<td>
<a href="index.php"><i class="glyphicon glyphicon-eye-open" title="Visualizar"></i></a>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<center>
<ul class="pagination">
<li><a><?php echo $links; ?></a></li>
<ul>
</center>
</div>
Here is the CONTROLLER
public function consultaClientes() {
$this->output->enable_profiler(TRUE);
$this->load->model("Cliente/Clientes_Model");
$config["base_url"] = base_url('index.php/Cliente/');
$config["total_rows"] = $this->Clientes_Model->record_count();
$config["per_page"] = 5;
$config['use_page_numbers'] = TRUE;
$config["uri_segment"] = 3;
$choice = $config["total_rows"] / $config["per_page"];
$config["num_links"] = round($choice);
$this->pagination->initialize($config);
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
$data["results"] = $this->Clientes_Model
->fetch_countries($config["per_page"], $page);
$data["links"] = $this->pagination->create_links();
$this->load->view("menu");
$this->load->view("Cliente/Clientes", $data);
}
Here the MODEL
public function record_count() {
return $this->db->count_all("cliente");
}
public function fetch_countries($limit, $start) {
$this->db->limit($limit, $start);
$query = $this->db->get("cliente");
if ($query->num_rows() > 0) {
foreach ($query->result() as $row) {
$data[] = $row;
}
return $data;
}
return false;
}
There is still a configured route.
$route['Cliente'] = 'Cliente/Clientes/consultaClientes';