★ wanayoo — archive 1999 http://www.devshed.com/Talk/Forums/Forum5/HTML/001077.htmlNouvelle recherche | Portail wanayoo
DevShed Menu
* DevShed Home
* Developer News
* DevShed Brain Dump




UBBFriend: Email This Page to Someone!
  DevShed Discussion Forums
  PHP
  Join function

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   Join function
Abe Facciazzi
Member
posted May 10, 2000 07:31 AM     Click Here to See the Profile for Abe Facciazzi   Click Here to Email Abe Facciazzi     Edit/Delete Message Reply w/Quote
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", "");

mysql_select_db("millennio",$db);

$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 php.net and the syntax looks correct. Anyone has a suggestion?

falcon
Member
posted May 11, 2000 06:28 AM     Click Here to See the Profile for falcon   Click Here to Email falcon     Edit/Delete Message Reply w/Quote
Hi,

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.

Falcon

All times are MST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | DevShed.com

Copyright © 1997-2000 ngenuity. All rights reserved.

Powered by: Ultimate Bulletin Board, Version 5.41a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 1999.