I have 3 tables

Posts
Followers
Users

My Posts table has an id, title, body, created, user_id, category_id

1 | New Title | Some text here | 12/19/11 | 101 | 10
2 | Nwr Title | Something here | 12/19/11 | 105 | 15
3 | Agn Title | Body Text here | 12/19/11 | 110 | 20

My Followers table has a user_id, category_id

1 | 10
2 | 10
2 | 20
3 | 10
3 | 15
3 | 20

My Users table has id, username, password, email

101 | User1 | password | us...@example.com
105 | User2 | password | us...@example.com
110 | User3 | password | us...@example.com

I am going to set up a cron job that will email every user the posts
from today, from the categories they're following. So I need something
like this:

For each post from today, email the users who are following that
category.

Example: User 2 would get 2 emails. From both posts 1 & 3 because he
is following categories 10 & 20.... I've gotten close, but I cannot
get the syntax right for the code. Please help. Thanks!



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to