Guest User

Untitled

a guest
Jan 21st, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. How to sort photos in order of likes, comments entries desc. Need to get all rows of photos, photo.comments, photo.likes
  2.  
  3.  
  4. photos
  5. ------------
  6. id
  7. url
  8. created
  9. modified
  10.  
  11. likes
  12. --------
  13. id
  14. photo_id
  15. user_id
  16. created
  17. modified
  18.  
  19. comments
  20. ----------
  21. id
  22. photo_id
  23. user_id
  24. comment
  25. created
  26. modified
  27.  
  28.  
  29. Example : if comments or likes have a new entry, this photo should be first.
  30.  
  31.  
  32. Data Example Output
  33.  
  34. Photo
  35. (
  36. [0] => Array
  37. (
  38. [id] => 1
  39. [file_name] => 20111012073528_1_1.jpg
  40. [created] => 2011-10-12 11:05:28
  41. [modified] => 2011-10-12 11:05:28
  42. [Comment] => Array
  43. (
  44. [0] => Array
  45. (
  46. [id] => 8
  47. [photo_id] => 8
  48. [guest_id] => 4
  49. [comment] => dfgdfg
  50. [created] => 2011-10-13 07:53:54
  51. [modified] => 2011-10-13 07:53:54
  52. )
  53. )
  54.  
  55. [Like] => Array
  56. (
  57. [0] => Array
  58. (
  59. [id] => 2
  60. [photo_id] => 1
  61. [guest_id] => 4
  62. [created] => 2011-10-12 07:41:21
  63. [modified] => 2011-10-12 07:41:21
  64. )
  65.  
  66. )
  67.  
  68. )
  69.  
  70. [1] => Array
  71. (
  72. [id] => 2
  73. [file_name] => 20111012073528_1_2.jpg
  74. [created] => 2011-10-12 11:05:28
  75. [modified] => 2011-10-12 11:05:28
  76. [Comment] => Array
  77. (
  78. )
  79.  
  80. [Like] => Array
  81. (
  82. )
  83.  
  84. )
Add Comment
Please, Sign In to add comment