Warning: join() [function.join]: Invalid arguments passed (PHP/MySQL Query)

David Blomstrom

Can anyone tell me what's wrong with my code? I get the error message "Warning: join() [function.join]: Invalid arguments passed in..." on the very last line - echo join( $URL, '
' );

I checked this discussion and this one, but nothing clicks. I pasted my query into phpMyAdmin > SQL, and it works perfectly, returning a table with two columns listing values in the field URL that have multiple instances along with the number of instances (e.g. Bill_Gates | 4).

So it looks like there must be a problem with my code - unless there's a bug in a file higher up the food chain, but I don't think that's likely.

$stm = $pdo->prepare("select URL, count(*)
from ((SELECT 'GZ' AS GSiteID, NULL as Site, 'Life' AS GSection, GZL.Taxon AS URL
       FROM gz_life GZL WHERE GZL.Taxon = :MyURL
      ) UNION ALL
      (SELECT 'All' AS GSiteID, NULL as Site, 'World' AS GSection, GG.Name AS URL
       FROM gw_geog GG WHERE GG.Name = :MyURL
      ) UNION ALL
      (SELECT 'PX' AS GSiteID, Site, 'People' AS GSection, Ppl.URL
       FROM people Ppl WHERE Ppl.URL = :MyURL
      )
     ) t
group by URL
having count(*) > 1;");
 $stm->execute(array(
 'MyURL'=>$MyURL
 ));

while ($row = $stm->fetch())
{
 $URL = $row['URL'];
}

echo join( $URL, '<br>' );

P.S. I posted var_dump($URL); at the very end of the above script, but it only displays string(9) "Zachaenus", which doesn't make any sense to me. (I think Zachaenus is a scientific name from the table Life.) But I've never used var_dump before so maybe I'm not doing it correctly.

Shankar Damodaran

You need to make use of the glue parameter first.

echo join( '<br>',$URL );
           ^^^^^  ^^^^   //<---- Order Interchanged 

Alternatively, you could make use of implode which does the same of the join.

Secondly.. the $URL must be array.

$URL = array();
while ($row = $stm->fetch())
{
 array_push($URL,$row['URL']);
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Warning: join() [function.join]: Invalid arguments passed (PHP/MySQL Query)

From Dev

Implementing a join function that is being passed 3 arguments

From Dev

SQL Join Invalid length parameter passed to the LEFT or SUBSTRING function

From Dev

Warning: implode(): Invalid arguments passed in : Joomla ?

From Dev

Issue with join and sum in mysql query: invalid use of group function

From Dev

[function.implode]: Invalid arguments passed error

From Dev

foreach() : invalid arguments passed

From Dev

Query with join or without join?

From Dev

Using GROUP BY SQL Function in a query with JOIN

From Dev

Can't .join() function arguments - TypeError: undefined is not a function

From Dev

Can't .join() function arguments - TypeError: undefined is not a function

From Dev

Join is not a function

From Dev

Invalid object name error in MySql Server Inner join query

From Dev

The arguments are not passed into the function correctly

From Dev

mysql join query - QUERY

From Dev

warning: incorrect argument passed to function

From Dev

The best overloaded method match for 'string.Join(string, string[])' has some invalid arguments

From Dev

Warning: DOMXPath::query(): Invalid expression

From Dev

Can't solve 'Invalid arguments passed'

From Dev

Message: implode(): Invalid arguments passed in codeigniter

From Dev

implode(): Invalid arguments passed laravel checkbox

From Dev

Arguments not passed to function in c Kernel

From Dev

Catching variables passed to function with no arguments

From Dev

Bash function arguments not passed as expected

From Dev

Access arguments of a function passed as argument

From Dev

Catching variables passed to function with no arguments

From Dev

Can we use split function on the fields used to join in a hive query

From Dev

Oracle SQL Query - Join when using MAX() function

From Dev

How to join the result of different aggregate function in the same query?

Related Related

  1. 1

    Warning: join() [function.join]: Invalid arguments passed (PHP/MySQL Query)

  2. 2

    Implementing a join function that is being passed 3 arguments

  3. 3

    SQL Join Invalid length parameter passed to the LEFT or SUBSTRING function

  4. 4

    Warning: implode(): Invalid arguments passed in : Joomla ?

  5. 5

    Issue with join and sum in mysql query: invalid use of group function

  6. 6

    [function.implode]: Invalid arguments passed error

  7. 7

    foreach() : invalid arguments passed

  8. 8

    Query with join or without join?

  9. 9

    Using GROUP BY SQL Function in a query with JOIN

  10. 10

    Can't .join() function arguments - TypeError: undefined is not a function

  11. 11

    Can't .join() function arguments - TypeError: undefined is not a function

  12. 12

    Join is not a function

  13. 13

    Invalid object name error in MySql Server Inner join query

  14. 14

    The arguments are not passed into the function correctly

  15. 15

    mysql join query - QUERY

  16. 16

    warning: incorrect argument passed to function

  17. 17

    The best overloaded method match for 'string.Join(string, string[])' has some invalid arguments

  18. 18

    Warning: DOMXPath::query(): Invalid expression

  19. 19

    Can't solve 'Invalid arguments passed'

  20. 20

    Message: implode(): Invalid arguments passed in codeigniter

  21. 21

    implode(): Invalid arguments passed laravel checkbox

  22. 22

    Arguments not passed to function in c Kernel

  23. 23

    Catching variables passed to function with no arguments

  24. 24

    Bash function arguments not passed as expected

  25. 25

    Access arguments of a function passed as argument

  26. 26

    Catching variables passed to function with no arguments

  27. 27

    Can we use split function on the fields used to join in a hive query

  28. 28

    Oracle SQL Query - Join when using MAX() function

  29. 29

    How to join the result of different aggregate function in the same query?

HotTag

Archive