[eluser]snowstar[/eluser]
Hi All,
not sure how to query my db to get the right result
my controller
Code:
function export_multimedia()
{
$this->load->dbutil();
$delimiter = ",";
$newline = "\r\n";
$this->db->join('bandinfo', 'bandinfo.uniqueid = multimedia.uniqueid');
$this->db->select('*');
$this->db->from('multimedia');
$query = $this->db->get();
$export = $this->dbutil->csv_from_result($query, $delimiter, $newline);
$this->load->helper('file');
write_file('/export/mybackup.csv', $export);
$this->load->helper('download');
force_download('mybackup.csv', $export);
}
Basically i need to match the uniqueid field in bandinfo(table) to multimedia(table) bandname field where bandinfo.uniqueid and multimedia.uniqueid match.
IE:
Multimedia table:
Unique id Food Color
22 Chicken Green
24 Pork Yellow
Bandinfo
Uniqueid bandname
22 something
23 something else
CSV to export as:
Unique id bandname food color
22 something chicken green
Any help is much appreciated