Problems when showing my subcategory

0

I want to show the subcategory with and the list with

  • I get an error in the array sample     
  • asked by 1MALJ1 24.06.2017 в 20:02
    source

    2 answers

    0

    I made the changes you told me I tried too, the same way I get the error that I'm wrongly implementing the implode or in the array or string.

        
    answered by 24.06.2017 в 21:16
    0

    The query on line 25 fails because the '...IN ('".$base."')...' must contain a series of values separated by commas inside the parentheses, type (1,2,3,4) , and you are including a string that comes from doing a implode separated by " " instead of "," .

    $base is a string since you fill it with a string when doing implode , not an array, do not put $base[] .

    Try these changes.

    Added to the answer: what was left to correct is that the implode must be done after the foreach, when the data array is already there, not while the elements are added.

    $data = array ();
    foreach ($resultado as $elemento) {
      $data[] = $elemento["id"];
    }
    $string = implode (",",$data);
    
        
    answered by 24.06.2017 в 20:13