gammaman Posted April 6, 2010 Share Posted April 6, 2010 I need help inserting multiple rows into an Oracle database. I get some errors. I think it is because I need to be using a loop to do the insert but I do not know how. I could also possibly be doing the binding wrong. I start out with a form and then POST to a PHP page and go from there. Here is a short hand form. Not the full code. for($i=0;$i<=10;$i++) { <input fname="first[]/> <input lname="last[]"/> <input age ="age[]"/> } $fname = $_POST['first']; $lname = $_POST['last']; $age = $_POST['age']; ** NOTE: These are now arrays. ***** I think somewhere here I need to do a loop for the insert $result = oci_parse($conn, 'INSERT INTO TABLE (first,last,age) VALUES (:first,:last,:age)'); **** I get an error on the binds saying I cannot have an array to string conversion. oci_bind_by_name($result, ':first',$first); oci_bind_by_name($result, ':last',$last); oci_bind_by_name($result, ':age',$age); Since all of the fields are not null and I have ten rows in the form according to the for loop, I would like to somehow check to see which rows are blank. Meaning that they were not filled out and get rid of them. Otherwise there would be an error on insert becasue the fields are not null.gammaman Link to comment https://forums.phpfreaks.com/topic/197805-insert-multiple-rows-into-oracle-database/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.