Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to sort photos in order of likes, comments entries desc. Need to get all rows of photos, photo.comments, photo.likes
- photos
- ------------
- id
- url
- created
- modified
- likes
- --------
- id
- photo_id
- user_id
- created
- modified
- comments
- ----------
- id
- photo_id
- user_id
- comment
- created
- modified
- Example : if comments or likes have a new entry, this photo should be first.
- Data Example Output
- Photo
- (
- [0] => Array
- (
- [id] => 1
- [file_name] => 20111012073528_1_1.jpg
- [created] => 2011-10-12 11:05:28
- [modified] => 2011-10-12 11:05:28
- [Comment] => Array
- (
- [0] => Array
- (
- [id] => 8
- [photo_id] => 8
- [guest_id] => 4
- [comment] => dfgdfg
- [created] => 2011-10-13 07:53:54
- [modified] => 2011-10-13 07:53:54
- )
- )
- [Like] => Array
- (
- [0] => Array
- (
- [id] => 2
- [photo_id] => 1
- [guest_id] => 4
- [created] => 2011-10-12 07:41:21
- [modified] => 2011-10-12 07:41:21
- )
- )
- )
- [1] => Array
- (
- [id] => 2
- [file_name] => 20111012073528_1_2.jpg
- [created] => 2011-10-12 11:05:28
- [modified] => 2011-10-12 11:05:28
- [Comment] => Array
- (
- )
- [Like] => Array
- (
- )
- )
Add Comment
Please, Sign In to add comment