[eluser]gr0uch0mars[/eluser]
I don't know why it returns no result, and num_rows() doesn't work (I think query is wrong, but I don't know where):
Code:
$this->db->select('issues.*, personnel.id AS artist_id, personnel.name AS artist');
$this->db->from('issues, personnel');
$this->db->where('issues.id', $issue_id);
$this->db->where('personnel.id', 'issues.artist_id');
$issue_q = $this->db->get();
return $issue_q;
(assuming
$issue_id is a number)
If I construct the query directly, it works, but I'd rather use Active Record. Here I leave the direct query, if anyone knows how to solve the AR code, please tell me. I'd appreciate it!
Code:
$issue_q = $this->db->query("SELECT issues.*, personnel.id AS artist_id, personnel.name AS artist FROM issues, personnel WHERE issues.id = $issue_id AND personnel.id = issues.artist_id");
The fact that CI adds apostophres to the statement might be a problem? (I saw it with the Profiler)
Thanks!