hybmg57 Posted December 18, 2010 Share Posted December 18, 2010 Hi, I have a very large multi-dimensional array to be inserted into MySQL database. It keeps up coming up with "MySQL server has gone away" error. I heard that I need to change the MySQL data limit but my hosting provider does not allow me to do so. I was thinking maybe input bit by bit but I wasn't 100% sure the best way of doing this. What is the best way do you think? Quote Link to comment https://forums.phpfreaks.com/topic/222025-large-array-variable-insert-into-mysql/ Share on other sites More sharing options...
hybmg57 Posted December 19, 2010 Author Share Posted December 19, 2010 Anyone? Please help! Quote Link to comment https://forums.phpfreaks.com/topic/222025-large-array-variable-insert-into-mysql/#findComment-1149369 Share on other sites More sharing options...
PFMaBiSmAd Posted December 19, 2010 Share Posted December 19, 2010 You forgot to show us how you are currently trying to insert the data and what size it is. Quote Link to comment https://forums.phpfreaks.com/topic/222025-large-array-variable-insert-into-mysql/#findComment-1149372 Share on other sites More sharing options...
hybmg57 Posted December 20, 2010 Author Share Posted December 20, 2010 Below is the code and this is the site: http://test6.favstay.com/ <?php include ('db.php'); include ('mls.php'); soapImportNWMLS("Listing","Residential","2010-12-14T12:00:00","2010-12-14T23:59:59","","","",""); print_r($dataArray); foreach($dataArray[RESI][Residential] as $data){ foreach($data as $key1 => $data1){ echo $key1." = ".$data1."<BR>"; $key2[] = "`".$key1."`"; $data2[] = "'".$data1."'"; } $key1 = mysql_real_escape_string(implode(", ",$key2)); $data1 = implode(", ",$data2); echo "<br>".$key1."<br><br>"; echo $data1."<br><br>"; mysql_query("INSERT INTO RESI ($key1) VALUES($data1)") or die(mysql_error()); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/222025-large-array-variable-insert-into-mysql/#findComment-1149438 Share on other sites More sharing options...
hybmg57 Posted December 21, 2010 Author Share Posted December 21, 2010 Apparently I heard that it gets timed out due to time it takes for executing the insert command. Is there a way we can tackle this? Quote Link to comment https://forums.phpfreaks.com/topic/222025-large-array-variable-insert-into-mysql/#findComment-1149780 Share on other sites More sharing options...
PFMaBiSmAd Posted December 21, 2010 Share Posted December 21, 2010 Have you even determined that your code is reading the source data, at all, or in a timely manor? Quote Link to comment https://forums.phpfreaks.com/topic/222025-large-array-variable-insert-into-mysql/#findComment-1149927 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.