Guest User

Untitled

a guest
Jul 9th, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. id | id_course | lesson_title
  2. 1 | 3 | Урок 1
  3. 2 | 3 | Урок 2
  4. 3 | 3 | Урок 3
  5. 4 | 4 | Урок 4
  6. 5 | 4 | Урок 5
  7.  
  8. id | id_lesson | email | date
  9. 43 | 1 | 123@gmail.com | 2018-07-09 13:17:05
  10. 44 | 2 | 123@gmail.com | 2018-07-09 13:18:05
  11. 45 | 3 | 123@gmail.com | 2018-07-09 13:19:05
  12.  
  13. function total_score($id){
  14. global $connection;
  15. $query = "SELECT l.id_course, h.email, MAX(h.date) FROM lesson l LEFT JOIN history h ON h.eid = l.id GROUP BY l.id_course, h.email HAVING SUM(h.eid IS NULL) = 0 WHERE l.id_course= '$id'";
  16. $res = mysqli_query($connection, $query);
  17. $total_score = array();
  18. while($row = mysqli_fetch_assoc($res)){
  19. $total_score[$row['date']] = $row;
  20. }
  21. return $total_score;
  22. }
  23.  
  24. SELECT l.id_course, h.email, MAX(h.date)
  25. FROM lesson l
  26. LEFT JOIN history h ON h.id_lesson = l.id
  27. GROUP BY l.id_course, h.email
  28. HAVING SUM(h.id_lesson IS NULL) = 0
Add Comment
Please, Sign In to add comment