Jump to content

problem with array and mysql insert


croakingtoad

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?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.