I am currently developing a module for ExpressionEngine and have a quick questions regarding outputting database queries into the table class.
The only way I have managed to do this is via the following:
$this->EE=& get_instance();
$this->EE->load->library('table');
$data = $this->EE->db->query("SELECT * FROM my_table");
echo $this->EE->table->generate($data);
This is great, but I would like to input some additional options in the table such as "Duplicate" and "Delete". To do this I need to be able to out put the query results individually. I have attempted the following:
$this->EE=& get_instance();
$this->EE->load->library('table');
$query = $this->EE->db->query("SELECT * FROM my_table");
if ($query->num_rows() > 0)
{
foreach($query->result_array() as $row)
{
$this->EE->table->add_row(
echo $row['id']."<br />\n";
);
}
}
echo $this->EE->table->generate();
With the above I receive the following error "Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting '".
Any assistance would be appreciated.
Many thanks Ben
$this->EE->table->add_row($row['id']);
Try that instead.