Advertisement
Guest User

Untitled

a guest
Apr 8th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "root";
  5. $dbname = "database";
  6. $conn = new mysqli($servername, $username, $password, $dbname);
  7. $id=$_GET['id'];
  8. if ($conn->connect_error) {
  9. die("Connection failed: " . $conn->connect_error);}
  10. $sql = "SELECT DAY(ADDDATE(`dateC`, `durationC`)) AS month,DAY(ADDDATE(ADDDATE(`dateC`, `durationC`),`durationR`))AS days FROM normaltb where id = '$id'");
  11. $result = $conn->query($sql);
  12. if ($result->num_rows > 0) {
  13. while($row = $result->fetch_assoc()) {
  14. echo $row["month"]. "<br>";
  15. echo $row["days"]. "<br>";
  16.  
  17.  
  18. }
  19. }
  20. else {
  21. echo "0 results";
  22.  
  23. }
  24. $conn->close();
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement