Guest User

Untitled

a guest
Nov 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. questions answers
  2. +-----+---------+ +------+------+---------+
  3. | id_q| question| | id_q | id_a | answer |
  4. +=====+=========+ +======+======+=========+
  5. | 1 |question1| | 1 | 1 | answer1 |
  6. +-----+---------+ +------+------+---------+
  7. | 2 |question2| | 1 | 2 | answer2 |
  8. +-----+---------+ +------+------+---------+
  9. | 1 | 3 | answer3 |
  10. +------+------+---------+
  11. | 1 | 4 | answer4 |
  12. +------+------+---------+
  13. | 2 | 5 | answer5 |
  14. +------+------+---------+
  15. | 2 | 6 | answer6 |
  16. +------+------+---------+
  17. | 2 | 7 | answer7 |
  18. +------+------+---------+
  19. | 2 | 8 | answer8 |
  20. +------+------+---------+
  21.  
  22. this->db->SELECT('*');
  23. this->db->FROM('answers');
  24. this->db->WHERE('answers.id_q', $x); // $x -> variable that has the id o the selected question
  25. this->db->UPDATE('answers', $data);
  26.  
  27. answers
  28. +------+------+---------+
  29. | id_q | id_a | answer |
  30. +======+======+=========+
  31. | 1 | 1 | answer1 |
  32. +------+------+---------+
  33. | 1 | 2 | answer1 |
  34. +------+------+---------+
  35. | 1 | 3 | answer1 |
  36. +------+------+---------+
  37. | 1 | 4 | answer1 |
  38. +------+------+---------+
Add Comment
Please, Sign In to add comment