PHP Classes

How do I INSERT multiple rows using query_secure method?

Recommend this page to a friend!

      PDO Multi Connection Class  >  All threads  >  How do I INSERT multiple rows using...  >  (Un) Subscribe thread alerts  
Subject:How do I INSERT multiple rows using...
Summary:How to insert multiple rows using query_secure()
Messages:1
Author:Fikayo Adeyemo
Date:2021-05-12 14:43:52
 

  1. How do I INSERT multiple rows using...   Reply   Report abuse  
Picture of Fikayo Adeyemo Fikayo Adeyemo - 2021-05-12 14:43:52
I can do single row insert easily:
e.g.
$params = array(1, "John Smith", "Male");
$result = $db->query_secure("INSERT INTO EMPLOYEES (EMPID,NAME,SEX) VALUES(?,?,?);", $params, false, true);

But I want to insert TWO records at the same time.
e.g.
$params = array(1, "John Smith", "Male",2, Mary Black, "Female");
$result = $db->query_secure("INSERT INTO EMPLOYEES (EMPID,NAME,SEX) VALUES(?,?,?);", $params, false, true);

How can this be done - either with named placeholder or unnamed placeholder please?