Welcome Guest, Not a member yet? Register   Sign In
confusing mysql_num_rows() error
#6

[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!


Messages In This Thread
confusing mysql_num_rows() error - by El Forum - 09-10-2007, 12:47 PM
confusing mysql_num_rows() error - by El Forum - 09-10-2007, 12:54 PM
confusing mysql_num_rows() error - by El Forum - 09-11-2007, 09:14 AM
confusing mysql_num_rows() error - by El Forum - 10-01-2007, 04:58 AM
confusing mysql_num_rows() error - by El Forum - 10-13-2007, 04:20 PM
confusing mysql_num_rows() error - by El Forum - 06-04-2009, 05:48 AM
confusing mysql_num_rows() error - by El Forum - 06-04-2009, 07:25 AM
confusing mysql_num_rows() error - by El Forum - 06-04-2009, 07:27 AM
confusing mysql_num_rows() error - by El Forum - 06-04-2009, 07:33 AM
confusing mysql_num_rows() error - by El Forum - 03-02-2010, 09:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB