Thread: Join function

  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Rep Power
    I'm trying to use the join function but with poor results. Here follows a piece of a code I'm writing:

    $db = mysql_connect("localhost", "");


    $result = mysql_query("select DISTINCT nome from sotuttoio where nomequiz = 'xfiles'",$db);

    while ($values = mysql_fetch_array($result)){
    //build an array here of all the names that were pulled
    $nomearray = $values[nome];

    //join the array into a string separated by commas
    $list = join(",", $nomearray);

    $resultnome = mysql_query("select DISTINCT nomequiz from sotuttoio where nome in '$list' and nomequiz != 'xfiles',$db");

    while ($values = mysql_fetch_array($resultnome)){
    //build an array here of all the names that were pulled
    $quizarray = $values[nomequiz];
    //join the array into a string separated by commas
    $list = join(",", $quizarray);

    for ($x =0; x < sizeof($quizarray); $x++){
    $resultok = mysql_query("select count(*) as mycount from sotuttoio where nomequiz = '$quizarray[$x]' and
    nome in '$list'");

    At both instances of "join" I get this error message from the browser:
    Bad arguments to join() in /usr/local/etc/httpd/htdocs/provas.php on line...

    I checked with and the syntax looks correct. Anyone has a suggestion?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 1999
    Rep Power

    1)Try swapping the parameters aroind for the join function.

    2)Try commenting out the second part and only working on the first part and get that working.

    3)Try creating a simple array and then using the join function.

    4)Try checking out what sort of information is being pasted around your arrays. I don't use MySQL but it doesn't look quite right to me, maybe it is I don't know.

    I hope that these suggestions help.


Similar Threads

  1. Uploading Files
    By vivekjain in forum ASP Programming
    Replies: 0
    Last Post: February 16th, 2004, 11:21 PM
  2. database access using thread
    By padmini in forum Visual Basic Programming
    Replies: 3
    Last Post: February 6th, 2004, 12:38 AM
  3. Win32::API Help!!!
    By robbydooo in forum Perl Programming
    Replies: 5
    Last Post: February 2nd, 2004, 02:25 PM
  4. passing a form's select name into a javascript function
    By kilt88 in forum JavaScript Development
    Replies: 1
    Last Post: January 6th, 2004, 01:12 PM
  5. Code Benchmarking Tests
    By infamous41md in forum C Programming
    Replies: 4
    Last Post: December 27th, 2003, 04:15 PM

IMN logo majestic logo threadwatch logo seochat tools logo