PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 10th, 2000, 08:31 AM
Abe Facciazzi Abe Facciazzi is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 11 Abe Facciazzi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
  #2  
Old May 11th, 2000, 07:28 AM
falcon falcon is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 1999
Location: UK
Posts: 50 falcon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 21 m 33 sec
Reputation Power: 14
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Join function

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap