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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
michaelk46
Forum Commoner
Posts: 67
Joined: Mon Oct 12, 2009 9:50 pm

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

Post 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']) . '"');
                                                                
            }
    } 
 
User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

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

Post 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 :)
michaelk46
Forum Commoner
Posts: 67
Joined: Mon Oct 12, 2009 9:50 pm

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

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