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()); } ?> 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. 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
Archived
This topic is now archived and is closed to further replies.