Jump to content

Archived

This topic is now archived and is closed to further replies.

croakingtoad

problem with array and mysql insert

Recommended Posts

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?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.