Estoy usando la clase de paginación CodeIgniter y todo funciona bien, pero quiero mostrarle al usuario solo algunas tablas de mi base de datos. Actualmente estoy usando este código:
function index() {
$this->load->library("pagination");
$this->load->library("table");
$this->table->set_heading("Id", "The Title", "The Content");
$config["base_url"] = "http://localhost/ci_helpbg/";
$config["total_rows"] = $this->db->get("helps")->num_rows();
$config["per_page"] = 5;
$config["num_links"] = 20;
$config["full_tag_open"] = "<div id="pagination">";
$config["full_tag_close"] = "</div>";
$this->pagination->initialize($config);
$data["records"] = $this->db->get("helps", $config["per_page"], $this->uri->segment(3));
$data["main_content"] = "index_view";
$this->load->view("includes/template", $data);
}
y estoy usando este código para mostrar la paginación en mi vista:
<?php echo $this->table->generate($records); ?>
<?php echo $this->pagination->create_links(); ?>
Quiero mostrarle al usuario solo los campos de tabla "fecha_descripción", "descripción", "foto_tumbra" y "fecha".
Gracias.
Respuestas
0 para la respuesta № 1seleccionar campos específicos por ejemplo
$this->db->select("t1.name, t1.fname,t1.phone,t1.email");
y crea un rol para los usuarios que parte les vas a mostrar.
0 para la respuesta № 2
Simplemente haga una declaración de selección única solo para paginación. algo como:
$this->db->select("*");
$this->db->from("table1, table2, table3"); //if you don"t want to use table4 or table5 just do not mention that in the statement.
después de esto agregue esto a su controlador donde está la paginación.
$data["gettables"] = $this->yourmodel_gettables(); //the model with your select statement
Espero eso ayude.