Page 1 of 1

Warning: implode() [function.implode]: Invalid arguments pas

Posted: Fri Jan 08, 2010 11:45 am
by michaelk46
Can anyone help me understand why I keep getting the error... Warning: implode() [function.implode]: Invalid arguments passed in

when I run this code...

Code: Select all

 
while ($row = mysqli_fetch_array($result))
    {
        $tableresult[] = array('cat' => $row['cat'], 'id' => $row['id'], 'image' => $row['image'], 'manu' => $row['manufacturer']);
        $cat = mysqli_query ($link, 'SELECT * FROM category WHERE cat = "' . ($row['cat']) . '"');
        switch ($cat)
            {
                case !NULL:
                    $catid = mysqli_query ($link, 'SELECT id FROM category WHERE cat = "' . ($row['cat']) . '"');
                    $catid = implode(",", $catid); 
                    mysqli_query ($link, 'UPDATE temptable SET catid ="' . $catid . '" WHERE = "' . ($row['id']) . '"');
                                                                
            }
    } 
 

Re: Warning: implode() [function.implode]: Invalid arguments pas

Posted: Fri Jan 08, 2010 12:27 pm
by flying_circus
mysqli_query returns a resource. You can't implode a resource. implode expects a string and an array as input, to ouput a string.

fetch a row from the resource and then implode that row.

The only reason I havent provided a working example, is because you've already done this within your code, at another location, so I think you can get this sorted on your own :)

Re: Warning: implode() [function.implode]: Invalid arguments pas

Posted: Sun Jan 10, 2010 2:42 pm
by michaelk46
Sorry to take so long to respond...

That response helped out a lot... It let me know I was on the right track, which I wasn't sure of and I figured out the issue.

Thanks again