You can provide placeholders with any names you want something like this for your SQL:
INSERT INTO propAmenities (amenity_id, property_id) VALUES (:amenity_id1, :property_id1), (:amenity_id2, :property_id2), (:amenity_id3, :property_id3)
And then:
$stmt->bindParam(':amenity_id1', 1); $stmt->bindParam(':property_id1', 1); $stmt->bindParam(':amenity_id2', 2); $stmt->bindParam(':property_id2', 1); $stmt->bindParam(':amenity_id3', 3); $stmt->bindParam(':property_id3', 1);
Or, of course, build the appropriate array for execute . In this case, unnamed placeholders may be easier to work with, although:
INSERT INTO propAmenities (amenity_id, property_id) VALUES (?, ?), (?, ?), (?, ?)
And then you can skip your values ββand call execute with the appropriate array:
$stmt->execute(array(1, 1, 2, 1, 3, 1));