PHP Mysql Artım Yabancı anahtar

0 Cevap php

nasıl ben elle yabancı anahtar artırmak yok. ive 2 tablolar var

masa kez

id-timeslot   times
------------------
   1       10:00
   2       10:30
   3       10:45
   4       11:00
   5       11:15
   6       11:30

Bir an için ben var masası kitabı

id-book   id-timeslot
-------------------
   1         1
   2         1  

Açılan menü (geçirmek dakika)

<select name="minutes_booking" id="minutes_booking">
        <option value="0">15 Minutes</option>
        <option value="1">30 Minutes</option>
        <option value="2">45 Minutes</option>
        </select>

lets say, the user select for 10:00 and "30 minutes to spend for the treatment" i want look like

   id-book   id-times
    -------------------
       1         1
       2         2   

php kodu:

if($minutes_booking == 0) :

     $mysqli->query("INSERT INTO doc_a(id_book, id_timeslot) 
     VALUES  ('','" . $id_timeslot . "')" ); 

     echo 'Booking has been added';

elseif($minutes_booking == 1) :


      $mysqli->query("INSERT INTO doc_a(id_book, id_timeslot) 
      VALUES  ('', '" . $id_timeslot . "')" ); 
      $mysqli->query("INSERT INTO doc_a(id_book, id_timeslot) 
      VALUES  ('', '" . $id_timeslot++ . "')" ); 
  echo 'Booking has been added';

 endif;

0 Cevap