posted May 10, 2000 07:31 AM
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?