SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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?

    Code PHP:
    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']) . '"');
     
    														}
    												}

  2. #2
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    Location
    was rainy Oregon now sunny Florida
    Posts
    1,099
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Before you do the implode, echo out $catid to make sure it has a value that you expect.
    What I lack in acuracy I make up for in misteaks

  3. #3
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    as far as i know mysqli_query returns the resource not the array and implode takes the array as second parameter.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  4. #4
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

  5. #5
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    Location
    was rainy Oregon now sunny Florida
    Posts
    1,099
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You have the query but you still need something like mysql's mysql_fetch_assoc()
    Then you should have something to implode
    What I lack in acuracy I make up for in misteaks

  6. #6
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •