I'm building a script which outputs an xml file but I can't generate all the data from a single query as the description can come from a variety of sources. So far I have:
// Select the products
$query = $this->db->select('id,sku,name,image')
->from('products')
->get();
// !!! Here's where I need help - I need to loop through the results and run
// another query based on the ID which will pull a description from
// a number of possible sources and then add the resulting description into
// the main $query object so it can still use xml_from_result()
// Load the Database Utilities
$this->load->dbutil();
// Configure the xml structure
$config = array (
'root' => 'root',
'element' => 'element',
'newline' => "\n",
'tab' => "\t"
);
// Output the xml doc
header('Content-type: text/xml');
echo $this->dbutil->xml_from_result($query, $config);
I can get the data I need by first executing a $query->result() but then I can no longer use $query with xml_from_result(). Any help would be greatly appreciated.