Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] array merge do not work correctly
#4

[eluser]kolxoznik1[/eluser]
Aken, here is my model.Do not know is it good query but here it is :

Code:
function user_picture_list($user_id)
    {
        $sql = "SELECT u.username as user, i.image as user_image, p.image, p.date
                FROM users u              
                LEFT JOIN user_follow f ON u.id = f.follow_id
                LEFT JOIN images p ON p.user_id = u.id
                LEFT JOIN images i ON i.id = (SELECT b.id FROM images AS b where p.user_id = b.user_id ORDER BY b.id DESC LIMIT 1)
                WHERE f.user_id = 3 OR p.user_id = 3      
                ORDER BY p.date DESC";
                
        $query = $this->db->query($sql);
        
        return $query->result_array();    
    }


Messages In This Thread
[SOLVED] array merge do not work correctly - by El Forum - 01-24-2012, 07:07 PM
[SOLVED] array merge do not work correctly - by El Forum - 01-24-2012, 07:16 PM
[SOLVED] array merge do not work correctly - by El Forum - 01-24-2012, 07:19 PM
[SOLVED] array merge do not work correctly - by El Forum - 01-24-2012, 07:25 PM
[SOLVED] array merge do not work correctly - by El Forum - 01-24-2012, 07:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB