0

I am trying to set time limit in reservation system. Such that Users must have the ability to remove their bookings, but not before the lapse of 1 minute away from the time when the booking has been entered

 <?php require_once 'connection.php'; if(isset($_SESSION['book'])){ if (isset($_SESSION['book_time'])){ if (time()-$_SESSION['book_time']>= 60){ if (isset($_POST['delete'])){ $machineID = $_POST['machine_id']; $starttime = $_POST['start_time']; $qry = "DELETE FROM bookings where machine_id = '$machineID' AND start_time = '$starttime'"; $result = mysql_query($qry,$conn); if ($result){ if(mysql_affected_rows()>0){ $message[] = 'Booking Deleted form DB'; } } } } } } ?> 

but it couldn't remove even after 1 min with this script....what could be possible problem

6
  • That's very nice. Is there no question? Commented Jan 31, 2014 at 9:31
  • 1
    Please specify what the problem is, what behavior you expect and which behavior you actually get. Commented Jan 31, 2014 at 9:32
  • There's no question he just wanted to congratulate oneself Commented Jan 31, 2014 at 9:32
  • Obligatory comment: Please filter your variables and/or using parameter binding to avoid sql injections. Commented Jan 31, 2014 at 9:33
  • he may want $starttime - 60 // 1min Commented Jan 31, 2014 at 9:33

1 Answer 1

1

Possible problems:

  • $_SESSION['book'] or $_SESSION['book_time'] or $_POST['delete'] is NULL
  • $machineID contains not exists ID
  • $starttime contains wrong time or time in wrong format

Try to dump this variables. If they are ok try to run query manualy.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.