blurredvision Posted July 31, 2008 Share Posted July 31, 2008 I have 15 separate INSERT INTO queries that I'm trying to insert into a table with one mysqli_multi_query function. However, only the first 10 of the 15 are going. I even attempted sending up the first 10, closing the connection, then reopening and sending the next 5, but that's not working either, just the first 10 show up. Before I post any code, I wanted to see if there was some kind ceiling I was hitting. Everything from the query statements (#'s 11 through 15 were copied and pasted from #'s 1 through 10 that work fine) to my columns in the table (there's enough room for the data I'm sending) look good. So, can you guys give me a quick hint as to what's going on, or will I have to post the code? Link to comment https://forums.phpfreaks.com/topic/117446-solved-trying-to-insert-15-queries-into-mysql-at-once-but-only-10-will-go/ Share on other sites More sharing options...
Highlander Posted July 31, 2008 Share Posted July 31, 2008 Are you using transactions? I mean do you send all INSERT's into one transaction? Link to comment https://forums.phpfreaks.com/topic/117446-solved-trying-to-insert-15-queries-into-mysql-at-once-but-only-10-will-go/#findComment-604112 Share on other sites More sharing options...
PFMaBiSmAd Posted July 31, 2008 Share Posted July 31, 2008 My guess would be you are duplicating index values and receiving an error from the query but your code has no error checking, error reporting, or error recovery logic in it to get it to tell you why it is failing. Without showing us what you are doing (code and data), no one can directly help you. Link to comment https://forums.phpfreaks.com/topic/117446-solved-trying-to-insert-15-queries-into-mysql-at-once-but-only-10-will-go/#findComment-604115 Share on other sites More sharing options...
blurredvision Posted July 31, 2008 Author Share Posted July 31, 2008 I have attached the basis of my queries to insert them into the database. When I run it like this, the data for the first 10 weeks insert perfectly fine. I have absolutely no issues with the first 10. However, the remaining 5 do not show up. I currently only have error checking on the database connection, but I don't know how to error check the queries. Also, in my PHP error checking, nothing shows as wrong. $week1insert = "INSERT INTO schedules (gamertag_id,season,week,opponent,home_away) VALUES ('$gamertag','$season',1,'{$_POST['week1']}','{$_POST['week1_home']}')"; $week2insert = "INSERT INTO schedules (gamertag_id,season,week,opponent,home_away) VALUES ('$gamertag','$season',2,'{$_POST['week2']}','{$_POST['week2_home']}')"; $week3insert = "INSERT INTO schedules (gamertag_id,season,week,opponent,home_away) VALUES ('$gamertag','$season',3,'{$_POST['week3']}','{$_POST['week3_home']}')"; $week4insert = "INSERT INTO schedules (gamertag_id,season,week,opponent,home_away) VALUES ('$gamertag','$season',4,'{$_POST['week4']}','{$_POST['week4_home']}')"; $week5insert = "INSERT INTO schedules (gamertag_id,season,week,opponent,home_away) VALUES ('$gamertag','$season',5,'{$_POST['week5']}','{$_POST['week5_home']}')"; $week6insert = "INSERT INTO schedules (gamertag_id,season,week,opponent,home_away) VALUES ('$gamertag','$season',6,'{$_POST['week6']}','{$_POST['week6_home']}')"; $week7insert = "INSERT INTO schedules (gamertag_id,season,week,opponent,home_away) VALUES ('$gamertag','$season',7,'{$_POST['week7']}','{$_POST['week7_home']}')"; $week8insert = "INSERT INTO schedules (gamertag_id,season,week,opponent,home_away) VALUES ('$gamertag','$season',8,'{$_POST['week8']}','{$_POST['week8_home']}')"; $week9insert = "INSERT INTO schedules (gamertag_id,season,week,opponent,home_away) VALUES ('$gamertag','$season',9,'{$_POST['week9']}','{$_POST['week9_home']}')"; $week10insert = "INSERT INTO schedules (gamertag_id,season,week,opponent,home_away) VALUES ('$gamertag','$season',10,'{$_POST['week10']}','{$_POST['week10_home']}')"; $week11insert = "INSERT INTO schedules (gamertag_id,season,week,opponent,home_away) VALUES ('$gamertag','$season',11,'{$_POST['week11']}','{$_POST['week11_home']}')"; $week12insert = "INSERT INTO schedules (gamertag_id,season,week,opponent,home_away) VALUES ('$gamertag','$season',12,'{$_POST['week12']}','{$_POST['week12_home']}')"; $week13insert = "INSERT INTO schedules (gamertag_id,season,week,opponent,home_away) VALUES ('$gamertag','$season',13,'{$_POST['week13']}','{$_POST['week13_home']}')"; $week14insert = "INSERT INTO schedules (gamertag_id,season,week,opponent,home_away) VALUES ('$gamertag','$season',14,'{$_POST['week14']}','{$_POST['week14_home']}')"; $week15insert = "INSERT INTO schedules (gamertag_id,season,week,opponent,home_away) VALUES ('$gamertag','$season',15,'{$_POST['week15']}','{$_POST['week15_home']}')"; mysqli_multi_query($dbc, "$week1insert;$week2insert;$week3insert;$week4insert;$week5insert;$week6insert;$week7insert;$week8insert;$week9insert;$week10insert;$week11insert,$week12insert;$week13insert;$week14insert;$week15insert"); Link to comment https://forums.phpfreaks.com/topic/117446-solved-trying-to-insert-15-queries-into-mysql-at-once-but-only-10-will-go/#findComment-604152 Share on other sites More sharing options...
ronnie88 Posted July 31, 2008 Share Posted July 31, 2008 sounds like a limit, try putting the 5 that isn't working into another file and include it at the end see what happens. Link to comment https://forums.phpfreaks.com/topic/117446-solved-trying-to-insert-15-queries-into-mysql-at-once-but-only-10-will-go/#findComment-604177 Share on other sites More sharing options...
PFMaBiSmAd Posted July 31, 2008 Share Posted July 31, 2008 I recommend forming the query in a variable and then echoing it to see what it actually contains. It would also be easier to use the multi-row insert syntax - INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9); Link to comment https://forums.phpfreaks.com/topic/117446-solved-trying-to-insert-15-queries-into-mysql-at-once-but-only-10-will-go/#findComment-604181 Share on other sites More sharing options...
blurredvision Posted July 31, 2008 Author Share Posted July 31, 2008 I recommend forming the query in a variable and then echoing it to see what it actually contains. It would also be easier to use the multi-row insert syntax - INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9); I think you and Ronnie were right. I changed my 15 different variables to just one multi-row insert syntax, and voila, now it works fine, and all 15 rows now show as expected. Must have been a 10-insert limit somewhere for my server. Thanks a lot guys! Link to comment https://forums.phpfreaks.com/topic/117446-solved-trying-to-insert-15-queries-into-mysql-at-once-but-only-10-will-go/#findComment-604183 Share on other sites More sharing options...
PFMaBiSmAd Posted July 31, 2008 Share Posted July 31, 2008 I was able to duplicated your 10 mysqli_multi_query symptom and there is apparently a (undocumented) limit. Link to comment https://forums.phpfreaks.com/topic/117446-solved-trying-to-insert-15-queries-into-mysql-at-once-but-only-10-will-go/#findComment-604199 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.