Guest User

Untitled

a guest
Feb 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. <?php
  2. $current_time = time();
  3.  
  4. $req = $bdd->prepare('SELECT * FROM flowers WHERE id_account = ?');
  5. $req->execute(array($_SESSION['id']));
  6.  
  7. while ($result = $req->fetch())
  8. {
  9. $difference = $current_time - $result['born'];
  10.  
  11. if ($difference >= 10)
  12. {
  13. $difference / 10;
  14. $cm = $result ['cm'] + 10;
  15.  
  16. $req1 = $bdd->prepare('UPDATE flowers SET cm = :cm, born = :born WHERE id_account = :id_account AND id = :id');
  17. $req1->execute(array(
  18. 'cm' => $cm,
  19. 'born' => $current_time,
  20. 'id_account' => $_SESSION['id'],
  21. 'id' => $result['id']
  22. ));
  23. }
  24.  
  25. else
  26. {
  27. }
  28. }
  29.  
  30. $req->closeCursor();
  31. ?>
Add Comment
Please, Sign In to add comment