I have a table with a name messageswith several rows:
+---------+
| columns |
+---------+
| id |
| from |
| to |
| body |
| date |
+---------+
What I want is to get a list of users of me messages or users who have sent me messages.
public function get_users_m($where)
{
$this->db->select('*');
$this->db->from('messages');
$this->db->where($where);
$this->db->group_by('from, to');
return $this->db->get()->result_array();
}
I did this with Codeigniter, but the problem is that I reply, for example, to C, I get the message A (me) to Cand Cto the message A, and I don't want me to want it just Conce, because it doesn't matter if I am the one who sent him a message, or he the one who will send me a message, this is still the same user.
source
share