I am currently using this type of SQL on MySQL to insert multiple rows of values in one single query:
INSERT INTO `tbl` (`key1`,`key2`) VALUES (\'r1v1\',\'r1
Here is my simple approach.
$values = array(); foreach($workouts_id as $value){ $_value = "(".$value.",".$plan_id.")"; array_push($values,$_value); } $values_ = implode(",",$values); $sql = "INSERT INTO plan_days(id,name) VALUES" . $values_.""; $stmt = $this->conn->prepare($sql); $stmt->execute();