Advertisement
Guest User

adi

a guest
May 2nd, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. function bookRentCars($car_id){
  2. $now = time();
  3. $newRetTime = $now + (3 * 60);
  4. $servername = 'localhost';
  5. $username = 'root';
  6. $password = '';
  7. $dbname = 'soa';
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. if($conn->connect_error){
  10. die("Connection failed : ".$conn->connect_error);
  11. }
  12. $sql = "UPDATE `rentcars` SET `avail`=0,`ret_time`='$newRetTime' WHERE car_id = '$car_id'";
  13. if (mysqli_query($conn, $sql)) {
  14. $message = array('message' => "berhasil");
  15. } else {
  16. $message = array('message' => "gagal");
  17. }
  18. $conn->close();
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement