croakingtoad Posted April 3, 2006 Share Posted April 3, 2006 So here's my code that I have (that isn't working)--[code] $count = 2; for ($i = 0; $i <= $count; $i++) { foreach($_arr[$i] as $key => $row) { if($key != 0) { echo "Value to insert- $_arr[$i][3]<br />"; mysql_query ("INSERT INTO $sql_table (mls) VALUES ('$_arr[$i][3]') "); } #endof if } #endof foreach } #endof for[/code]You can actually see part of the array I'm working with here-- [a href=\"http://roanokehousehunter.com/cron/csv2arrayManual.php\" target=\"_blank\"]http://roanokehousehunter.com/cron/csv2arrayManual.php[/a]I think my looping is off, but basically when I run this script I'm getting this as the result--[code]Value to insert- Array[3]Value to insert- Array[3]Value to insert- Array[3]Value to insert- Array[3]Value to insert- Array[3]Value to insert- Array[3]Value to insert- Array[3]Value to insert- Array[3]Value to insert- Array[3]Value to insert- Array[3][/code]And it's inserting "Array[3]" into the database fields. If you look at array[1][3] the value is "601815", that and corresponding is what I'm going for here...what am I doing wrong? Link to comment https://forums.phpfreaks.com/topic/6506-problem-with-array-and-mysql-insert/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.