Advertisement
Guest User

Untitled

a guest
Mar 20th, 2017
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. <?php
  2. //db conn............
  3.  
  4. $lat= 7;
  5. $query='SELECT timestamp FROM users';
  6. $result = mysql_query($query);
  7. while ($row = mysql_fetch_assoc($result)) {
  8.  
  9. $time = strtotime($row);
  10. $one_week_ago = strtotime('-1 day');
  11. $a=6;
  12.  
  13. if( $time > $one_week_ago ) { //not older than one day
  14.  
  15. $p="UPDATE users SET confirm ='$a'";
  16. if(mysql_query($p))
  17. {
  18. echo "$a";
  19. }
  20. else{
  21. echo "wrong";
  22. }
  23.  
  24. }
  25. else { //older than one day
  26. $query="UPDATE users SET street= '$lat' WHERE confirm !=$a";
  27.  
  28. if(mysql_query($query))
  29. {
  30. echo "sucsessful <br>";
  31. }
  32. else {
  33. echo "unsuccessful <br>";
  34. }
  35.  
  36. }
  37.  
  38. }
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement