Welcome Guest, Not a member yet? Register   Sign In
Simple database code not working ( Problem ongoing )
#1

[eluser]markanderson993[/eluser]
Hello, I am trying to extract information out of a database but I am not getting any results back. I believe there is something wrong with my code, if anybody can figure out what is wrong I would greatly appreciate the help!

The point of the code is to match the user's id to the pm_recipient id in a table then for each match it finds, run it through a foreach function to get the row's information and insert it into an array to be returned.

Code:
function get_messages($id)
    {
        $this->db->where('pm_recipient',$id);
        $get_pm_recipient_rows = $this->db->get('pm_recipient');
        if ($get_pm_recipient_rows->num_rows() != 0)
        {
        
            $pm_rows = array();
            
            foreach ($get_pm_recipient_rows->result() as $row)
            {
                $this->db->where('pm_id',$row->pm_id);
                $this->db->limit(1);
                $get_pm_thread_row = $this->db->get('pm_thread');
                $pm_thread_row = $get_pm_thread_row->row();
                
                $pm_rows[$row->pm_id] = $get_pm_thread_row->row();
            }
            
            return $pm_rows;
            
        } else {
            return 0;
        }
    }


Messages In This Thread
Simple database code not working ( Problem ongoing ) - by El Forum - 08-27-2008, 09:20 AM
Simple database code not working ( Problem ongoing ) - by El Forum - 08-27-2008, 10:11 AM
Simple database code not working ( Problem ongoing ) - by El Forum - 08-27-2008, 10:14 AM
Simple database code not working ( Problem ongoing ) - by El Forum - 08-27-2008, 12:05 PM
Simple database code not working ( Problem ongoing ) - by El Forum - 08-28-2008, 09:56 AM
Simple database code not working ( Problem ongoing ) - by El Forum - 08-28-2008, 10:04 AM
Simple database code not working ( Problem ongoing ) - by El Forum - 08-28-2008, 10:10 AM
Simple database code not working ( Problem ongoing ) - by El Forum - 08-28-2008, 10:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB