[eluser]JamieBarton[/eluser]
Hi guys,
I have a wall type thing on my website's dashboard, I want users to be able to see actions other users have done (these are stored inside a notifications table).
I'm having problems though, I think it has something to do with my joins.
In my table I have :
Code:
`notification_id` bigint(20) NOT NULL auto_increment,
`user_id` int(11) NOT NULL,
`is_photo` int(1) NOT NULL default '0',
`photo_id` bigint(20) NOT NULL default '0',
`is_album` int(1) NOT NULL default '0',
`album_id` bigint(20) NOT NULL default '0',
`is_wall` int(1) NOT NULL default '0',
`wall_id` bigint(20) NOT NULL default '0',
`family_id` bigint(20) NOT NULL,
PRIMARY KEY (`notification_id`)
These will just use 1 and 0 for the is_ and the _id's will hold the ID of the corrosponding photo/album/wallpost id.
My Query in my helper is:
Code:
function family_notifications( $fid, $lmt )
{
$this->db->where('notifications.family_id', $fid);
$this->db->join('users', 'users.user_id = notifications.user_id');
$this->db->join('photos', 'photos.photo_id = notifications.photo_id');
$this->db->join('albums', 'albums.album_id = notifications.album_id');
$this->db->order_by('notification_id', 'desc');
$this->db->limit($lmt);
return $this->db->get('notifications');
}
Perhaps you guys can help out, if I remove the JOINS, and put in dummy data it works.
Regards,
Jamie