CodeIgniter Forums
html table class - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: html table class (/thread-11299.html)



html table class - El Forum - 09-03-2008

[eluser]misterdonut[/eluser]
$this->load->library('table');

Code:
$querystr = "SELECT id, fname, lname FROM cc_clients WHERE fname LIKE '%$searchstr%'
                OR lname LIKE '%$searchstr%'
                OR concat(lname,' ',fname) LIKE '%$searchstr%'
                OR concat(fname,' ',lname) LIKE '%$searchstr%'";
                    
    $query = $this->db->query($querystr);
    
    if ($query->num_rows() > 0)
    {
        echo $this->table->generate($query);
    }
so can i add something the table class dynamically?
like

like another table cell
<a href="client/check/5"> check </a>
where 5 is the id.


html table class - El Forum - 09-03-2008

[eluser]xwero[/eluser]
First of all you can't add the query object to the generate method. You have to create an array first.

If you want to manipulate the raw db content you can do this in the the sql statement or in php that choice is up to you.


html table class - El Forum - 09-03-2008

[eluser]misterdonut[/eluser]
i'm using echo $this->table->generate($query); right now
its working just fine

how come i can't add it?


html table class - El Forum - 09-03-2008

[eluser]xwero[/eluser]
It's not in mentioned in the documentation but i saw in the code the query object is processed.

So if you want to add the query object to the generate function there is no other way than to manipulate the data in you sql statement by using concat in the select part.


html table class - El Forum - 09-03-2008

[eluser]misterdonut[/eluser]
good idea thanks


html table class - El Forum - 09-03-2008

[eluser]llbbl[/eluser]
do a foreach on query->result as row

url = <a href="client/check/5"> check </a>

then this-table-add_row(row-blah, row-food, url)