php - don't show results for certain amount after getting results from database -


i have big issue. have booking page have database time slots. when book in books in amount of slots depending on how long takes. there way can show available slots taking account how long takes doesn't clash , overlapping of next day.

    $servername = "localhost"; $username = "root"; $password = "root"; $dbname = "grass";  // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) {     die("connection failed: " . $conn->connect_error); }   $sql = "select id, day, hour availability booked='' , day >= curdate()"; $result = $conn->query($sql);  if ($result->num_rows > 0) {     // output data of each row     while($row = $result->fetch_assoc()) {             $next = date("m js ", strtotime("".$row["day"] .""));         echo "<a class='button' style='margin:10px;' href=book_process.php?pageid=" . $row["id"] . "> <p style='font-size:20px; margin:0px;'>$next</p> <br> ". $row["hour"]. "</a>";      } } else {     echo "you booked week"; } $conn->close(); 

additional information: each time slot 15 minutes long. have users table , availability table. users table has many things user including. time_taken contains how long takes user. availability has times. name of user , time , date.

basically, searches database slots exact number specify. example have job labelled 5. job takes 3. needs show slots 1 , 2., not 3 or 4 or 5 because clash other job.


Comments