MicroShaft Posted November 2, 2005 Share Posted November 2, 2005 Im trying to insert 1080 records into mysql. I extract the raw data from a table. place into a array. which is then split into an array (each element containing a record) I run a FOR loop to insert into the db. The problem: Only 855 records seem to get inserted : with no errors $thedata_rawL1=explode("\n",$thedata_raw); foreach ($thedata_rawL1 as $v) { $sql_insertloop="INSERT INTO ori_data (LOAD_ID,THEDATA) Values('$new_LOAD_ID','$v')"; $change_rs = mysql_db_query("originsuk",$sql_insertloop,$connect); } Can any one shed some light why i can only enter 855 when i have over 1000. I dont get no error messages. im using mysql 4 with php 4 Quote Link to comment Share on other sites More sharing options...
ryanlwh Posted November 2, 2005 Share Posted November 2, 2005 there were probably some duplicate keys that you aren't aware of. are the two tables different in structure? also, you wouldn't need to use a loop to copy tables, all you need is the INSERT INTO ... SELECT query [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']INSERT[/span] INTO ori_data (LOAD_ID,THEDATA) [span style=\'color:blue;font-weight:bold\']SELECT[/span] field1,field2 FROM table2 [!--sql2--][/div][!--sql3--] Quote Link to comment Share on other sites More sharing options...
MicroShaft Posted November 2, 2005 Author Share Posted November 2, 2005 there were probably some duplicate keys that you aren't aware of. are the two tables different in structure? also, you wouldn't need to use a loop to copy tables, all you need is the INSERT INTO ... SELECT query [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']INSERT[/span] INTO ori_data (LOAD_ID,THEDATA) [span style=\'color:blue;font-weight:bold\']SELECT[/span] field1,field2 FROM table2 [!--sql2--][/div][!--sql3--] 314183[/snapback] Okay, i just done some investigation. The raw data was originally posted via text area to the db. the data was pasted into a text area. for some reason even though a 1000 rows were pasted into the text area only 855 got inserted into the db which is a memo field. so the multiple insert was right. Now any ideas why the text area only inserted 855 rows into the memo field Quote Link to comment Share on other sites More sharing options...
Cook Posted November 3, 2005 Share Posted November 3, 2005 Must have to do with the maximum length of text a textarea can store. These things are not limitless... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.