[eluser]emily12[/eluser]
So I'm building a queue system where you can see a list of articles and a little queue button. It works fine but if the entry already exists, regardless of the user, it picks that one so it will act as if it is already queued even if it isn't.
In my model I have it to where everything joins in perfectly well (5 joins because of the complexity of everything) and it groups it by the article since that's what you're viewing is a list of articles.
In the view I check to see if the database entry for queued matches the ID and if it doesn't then you can queue it if you like. Well, the obvious problem happens here and it grabs the first result of the queued item in the database and shows that it's been queued if someone queued that specific article. Note that you can queue every article up to one time for all members at this point).
What should I do in order to query the queue table for that user id?
Model looks like this:
Code:
$this->db->select('*'); // Edited for ease of view
$this->db->from ('viewcounter AS b');
$this->db->join('articles AS p', 'p.articleid = b.id', 'left');
$this->db->join('phpbb_users AS d', 'p.author = d.user_id', 'left');
$this->db->join('categories AS c', 'c.id = p.subcat', 'left');
$this->db->join('queue AS f', 'f.queueaid = p.articleid', 'left');
$this->db->join('queue_type AS g', 'g.queuebitid = f.queuecat', 'left');
$this->db->where('p.subcategory >=', 27);
$this->db->where('p.subcategory <=', 45);
$this->db->group_by("b.id");
$this->db->order_by('b.views', "desc");
$this->db->limit($limit);
$query = $this->db->get();
return $query;
The column in question is queueuid (userid value) which is found in queue.
Thank you!
NOTES:
+ Adding "bookmark queue" to the database works fine
+ Each article has their own id which can be queued, works fine
+ User ID is fetched properly
- Each article as a result looks only for the first result if it even exists for the queue table. This needs to be for all of it.