Warning: implode() [function.implode]: Invalid arguments passed in

Can anyone help me understand why I keep getting

Warning: implode() [function.implode]: Invalid arguments passed in C:\wamp\www\Test\Upload\index.php on line 77

Whenever I run this?


while ($row = mysqli_fetch_array($result))
	{
		$tableres[] = 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']) . '"');
																
														}
												} 

Before you do the implode, echo out $catid to make sure it has a value that you expect.

as far as i know mysqli_query returns the resource not the array and implode takes the array as second parameter.

LorenW

Here is the result I get when I try the echo

Catchable fatal error: Object of class mysqli_result could not be converted to string in C:\wamp\www\Test\Upload\index.php on line 70

rajug

What would you suggest that i use?

You have the query but you still need something like mysql’s mysql_fetch_assoc()
Then you should have something to implode

First make sure the query is good and returning the proper result set/object. Then loop through that object and collect those ids in an array and use that array there.