Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. matrix_id, user_id, position_1, position_2, position_3
  2. 1 1 1982 2251 5841
  3. 2 2 6204
  4. 3 3
  5. 4 4
  6.  
  7. $find_user = $db->prepare("SELECT * FROM matrix WHERE user_id > :user_id");
  8. $find_user->bindValue(':user_id', 0);
  9. $find_user->execute();
  10. $result_user = $find_user->fetchAll(PDO::FETCH_ASSOC);
  11. if(count($result_user) > 0) {
  12. foreach($result_user as $row) {
  13. $matrix_id = $row['matrix_id'];
  14. $user_id = $row['user_id'];
  15. $position_1 = $row['position_1'];
  16. $position_2 = $row['position_2'];
  17. $position_3 = $row['position_3'];
  18. }
  19. } else {
  20. $errors[] = 'User Id not found in Matrix.';
  21. }
  22.  
  23. $update_user = $db->prepare("UPDATE matrix SET position_2 = :position_2 WHERE user_id = :user_id");
  24. $update_user->bindValue(':position_2', 1564;
  25. $update_user->bindParam(':user_id', $user_id);
  26. if($update_user->execute()) {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement