AR get own posts and friends posts |
[eluser]tommyadey[/eluser]
Hey guys, I have these tables; Code: user - contains user_id | username | fullname | email etcc I've tried Code: $this->db->select('posts.*')->from('posts') Can someone please help me out here? Many Thanks in advance.
[eluser]adamck[/eluser]
can you provide a .SQL export of you tables, this way i can import them to Phpmyadmin and test some queries. send it to my email, [email protected]
[eluser]jprateragg[/eluser]
I'm not familiar enough with AR to put your query in that format, but you could just use a regular SQL query: Code: SELECT p.post_title, p.post_date, u.username This would probably do what you want it to do.
[eluser]adamck[/eluser]
Just tested this Code: SELECT posts.* This gets all the posts that user 33 have made and all the posts from the people he's following
[eluser]tommyadey[/eluser]
Many thanks jprateragg and adamck, both worked perfectly, is there a way to use subquery/subselect in active record? |
Welcome Guest, Not a member yet? Register Sign In |