hybmg57 Posted December 12, 2010 Share Posted December 12, 2010 Hi, I was wondering if there was a way to insert array variables inside foreach to MySQL. Below is my code so far but it doesn't work. Thank you. <?php include ('db.php'); include ('mls.php'); soapImportNWMLS("Listing","Residential","2010-11-20T00:00:00","2010-11-23T23:59:59","","","",""); foreach($dataArray[RESI][Residential] as $data){ foreach($data as $key1 => $data1){ echo $key1." = ".$data1."<BR><BR>"; $key1=array($key1); $data1=array($data1); } print_r($key1); mysql_query("INSERT INTO RESI ($key1) VALUES($data1)") or die(mysql_error()); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/221398-insert-array-variables-in-foreach-to-mysql/ Share on other sites More sharing options...
fenway Posted December 12, 2010 Share Posted December 12, 2010 Echo the query. Quote Link to comment https://forums.phpfreaks.com/topic/221398-insert-array-variables-in-foreach-to-mysql/#findComment-1146319 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.