0

I want to select two columns from different tables: dbusers.students.ID and dbusers.parents.ID

Into another table of another database: dbrecords.consultations.SENDER

Which translates into CodeIgniter code as:

$this->dbrecords->select('consultations.*, dbusers.parents.*, dbusers.students.*');

$this->dbrecords->from('consultations');
$this->dbrecords->where('receiver', $id);
$this->dbrecords->order_by('DATE_SENT', 'DESC');
$this->dbrecords->order_by('TIME_SENT', 'DESC');

$this->dbrecords->join('sctporta_dbusers.parents', 'sctporta_dbusers.parents.ID = consultations.SENDER');
$this->dbrecords->join('sctporta_dbusers.students', 'sctporta_dbusers.students.ID = consultations.SENDER');

$query = $this->dbrecords->get();
return $query->result_array();

And I am getting empty results. If I try to only use two tables, it works. But I want to join the two tables into another table.

aronccs
  • 274
  • 3
  • 12
  • 30

0 Answers0