I am trying to insert multiple values in my database. But I could not find the Solution to do what I want.
My problem here is that I have a array of values like
("6.40","6.50","7.00","7.10","7.20","7.30")
and I want to insert these values in each row like 6.40 will store in one row corresponding of id "1".
Similarly "6.50" will store in id of "2". The id will just auto increment.
Similarly it will insert values in database until array empty. If anyone has any ideas on how to solve this problem please help me out! Please bear my doubts. I am new to PHP. Thanks in advance.
for ($i=0;$i < count($slot_timings1); $i++)
{
$q = $this->link->prepare('INSERT INTO doctor_appointment (doctor_name,doctor_id,appointment_date,slot_name,slot_timings) VALUES (:doctor_name,:doctor_id,:appointment_date,:slot_name,slot_timings)');
$q->execute(array(':doctor_name'=>$doctor_name,':doctor_id'=>$doctor_id, ':appointment_date'=>$appointment_date,':slot_name'=>$slot_name,':slot_timings'=>$slot_timings));
}
$counts = $q->rowCount();
return $counts;