Jump to content


Photo

problem with array and mysql insert


  • Please log in to reply
No replies to this topic

#1 croakingtoad

croakingtoad
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts
  • LocationUSA

Posted 03 April 2006 - 08:20 PM

So here's my code that I have (that isn't working)--
        $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

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--

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]

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?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users