HighDots Forums  

PHP Mysql problem

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss PHP Mysql problem in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
rG]Courage-D-
 
Posts: n/a

Default PHP Mysql problem - 11-20-2004 , 12:49 PM






Ok guys, I have a really big problem and I need some help. My website:
www.magnetgames.org I?m using a php mysql database. I?v set up a PHPBB forum.
Now I want on my main page, to show ALL USERS THAT ARE PART OF A USER GROUP.
That?s what I want. Now this is how the information is stored in the databases:
http://www.magnetgames.org/Problem.gif As you can see here, the username
from user_id 2 is Ajantis-X- So I want to show Ajantis-X- and all other users
that are part of the usergroup 4! How to do this? I know the basic php: SELECT
blablabla FROM blablabla WHERE blablabla = blablabla But I have no idea how to
do this, with the information stored in 2 different tables! Please help!


Reply With Quote
  #2  
Old   
rG]Courage-D-
 
Posts: n/a

Default Re: PHP Mysql problem - 11-20-2004 , 03:28 PM






I realy need an awnser, please. who knows php and can help me?

Reply With Quote
  #3  
Old   
rG]Courage-D-
 
Posts: n/a

Default Re: PHP Mysql problem - 11-21-2004 , 07:46 AM



SOMEONE??!!!??

please!

Reply With Quote
  #4  
Old   
Joaquim Lopes
 
Posts: n/a

Default Re: PHP Mysql problem - 11-21-2004 , 08:56 AM



To get all the users who belong to a certain group use something like this:
SELECT * FROM group,user WHERE group.group_id = x AND user.user_id = group.user_id.

Reply With Quote
  #5  
Old   
rG]Courage-D-
 
Posts: n/a

Default Re: PHP Mysql problem - 11-21-2004 , 09:10 AM



i tryed this:
'SELECT * FROM phpbb_users WHERE phpbb_user_groups.group_id = 4 AND phpbb_users.user_id = phpbb_user_groups.user_id. '
but that dosnt work!

Reply With Quote
  #6  
Old   
RT
 
Posts: n/a

Default Re: PHP Mysql problem - 11-21-2004 , 09:49 AM



You need a join I think to connect the two tables together - there are
extensions that help with this - look on the dream weaver site to find one.



On 11/20/04 12:49 PM, in article cno03h$4cl$1 (AT) forums (DOT) macromedia.com,
"rG]Courage-D-" <webforumsuser (AT) macromedia (DOT) com> wrote:

Quote:
Ok guys, I have a really big problem and I need some help. My website:
www.magnetgames.org I?m using a php mysql database. I?v set up a PHPBB forum.
Now I want on my main page, to show ALL USERS THAT ARE PART OF A USER GROUP.
That?s what I want. Now this is how the information is stored in the
databases:
http://www.magnetgames.org/Problem.gif As you can see here, the username
from user_id 2 is Ajantis-X- So I want to show Ajantis-X- and all other users
that are part of the usergroup 4! How to do this? I know the basic php:
SELECT
blablabla FROM blablabla WHERE blablabla = blablabla But I have no idea how
to
do this, with the information stored in 2 different tables! Please help!



Reply With Quote
  #7  
Old   
Joaquim Lopes
 
Posts: n/a

Default Re: PHP Mysql problem - 11-21-2004 , 11:10 AM



I just don't understand
What exactly don't you understand? The command I posted will return all the
fields of all the users in the user's table that belong to the group x (or four
in your case).

this are the tables: http://www.magnetgames.org/Problem.gif
Yes, I saw them before I posted my previous answer and ran a test with a table
I have that has a similar structure and it worked as was supposed to.


Reply With Quote
  #8  
Old   
rG]Courage-D-
 
Posts: n/a

Default Re: PHP Mysql problem - 11-21-2004 , 11:19 AM



maybe it might be a little bit mutch i ask, but can you create the code like i
can copy and past it? so when you first gave me this: SELECT * FROM group,user
WHERE group.group_id = x AND user.user_id = group.user_id. can you change it
so that i can use it without any changes (for example, change the X into a 4)
here is what i have now: (dosnt work)

mysql_select_db($database_localhost, $localhost);
$query_GuildMembers = "SELECT * FROM group,user WHERE group.group_id = 4 AND
user.user_id = group.user_id.";
$GuildMembers = mysql_query($query_GuildMembers, $localhost) or
die(mysql_error());
$row_GuildMembers = mysql_fetch_assoc($GuildMembers);
$totalRows_GuildMembers = mysql_num_rows($GuildMembers);


Reply With Quote
  #9  
Old   
Joaquim Lopes
 
Posts: n/a

Default Re: PHP Mysql problem - 11-21-2004 , 11:25 AM



Remove the dot at the end of the following line:
$query_GuildMembers = "SELECT * FROM group,user WHERE group.group_id = 4 AND user.user_id = group.user_id";

Reply With Quote
  #10  
Old   
Joaquim Lopes
 
Posts: n/a

Default Re: PHP Mysql problem - 11-21-2004 , 11:27 AM



You will have to change the names of the tables. I used group and user but I don't know if those are the correct names.

Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.