Welcome Guest, Not a member yet? Register   Sign In
Display 3 columns in pagination?
#1

[eluser]solid9[/eluser]
Hi guys

I have 4 columns from MySQL table,

1. ID
2. Date
3. Offering
4. Seeking

Now, How do I display 3 columns using the paginator & table class?
Exluding only the "Date" column?

Thanks in advanced.
#2

[eluser]CroNiX[/eluser]
Just use CSS to create your columns. This has nothing to do with pagination, just displaying the results.
#3

[eluser]machouinard[/eluser]
Code:
$this->db->select('ID, Offering, Seeking');

EDIT:
There's no pagination involved, but you could try this:
Code:
$this->load->library('table');
$this->db->select('ID, Offering, Seeking');
$this->db->from(Your_Table);
$query = $this->db->get();
$result = $query->result();
$array = array();
foreach($result as $row){
    $line = array($row->ID, $row->Offering, $row->Seeking);
    array_push($array, $line);
}
$this->table->set_heading('ID', 'Offering', 'Seeking');
echo $this->table->generate($array);

Or this if you prefer less codeSadassuming ID is a PK)
Code:
$this->load->library('table');
$query = $this->db->get(YOUR_TABLE)->result();
foreach($query as $row){
    $array[$row->ID] = array($row->ID, $row->Offering, $row->Seeking);
}
$this->table->set_heading('ID', 'Offering', 'Seeking');
echo $this->table->generate($array);




Theme © iAndrew 2016 - Forum software by © MyBB