Welcome Guest, Not a member yet? Register   Sign In
HTML table class as active record
#1

[eluser]jstrebel[/eluser]
Not sure if it is just me,

the HTML class will not render a table if passed a result from an active record query using $result or $result->result() or $result->array();
#2

[eluser]Colin Williams[/eluser]
Code?
#3

[eluser]jstrebel[/eluser]
doh.. what that hey..

so i code a couple examples to paste in.. and it decides to work.. my bad.

->result() does give a goofy table

<code>
$this->load->library('table');
$foo = $this->db->get("accounts");
$foo = $foo->result();
echo $this->table->generate($foo);
</code>
renders
<code>
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<td>Object id #19</td><td>Object id #20</td><td>Object id #21</td><td>Object id #22</td><td>Object id #23</td></tr>
</table>
</code>

but that may be expected.
#4

[eluser]Bramme[/eluser]
Sorry for the bump, but for future reference, it could be interesting.

You should simply use
Code:
$this->load->library(‘table’);
      $foo = $this->db->get(“accounts”);
      echo $this->table->generate($foo);




Theme © iAndrew 2016 - Forum software by © MyBB