Unstoppable Domains

PHP Question

Spaceship Spaceship
Watch
Impact
26
I am working on a site and I need some info. I have a "Friends" Module (picture myspace) and I need to to only pull members of a certain group ID. I think this is where pulls th list of members to add....

$sqlstr ="SELECT uid, uname, level FROM ".$db->prefix("users")." WHERE level>0 AND uid!=$myid LIMIT $inf, $tranche";


But I need to to pull from 2 tables so it will also get the groupid . I have written the sql statement to pull from where I need to but cant figure out how to write it into php . here is the sql statement

SELECT pop_users.uid, pop_users.uname, pop_groups_users_link.groupid
FROM pop_users, pop_groups_users_link
WHERE pop_users.uid = pop_groups_users_link.uid
AND groupid =4


This pulls the info I need.


Any help would be great.
 
1
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
In php you will need to use the mysql_query function:
PHP:
<?php
mysql_connect('localhost', 'username', 'password')or die(mysql_error());
mysql_select_db('database')or die(mysql_error());

$result = mysql_query('SELECT pop_users.uid, pop_users.uname, pop_groups_users_link.groupid FROM pop_users, pop_groups_users_link WHERE pop_users.uid = pop_groups_users_link.uid AND groupid =4')or die(mysql_error());

mysql_close();
?>
 
0
•••
So there is no way just to add to this

$sqlstr ="SELECT uid, uname, level FROM ".$db->prefix("users")." WHERE level>0 AND uid!=$myid LIMIT $inf, $tranche";

So it will pull from 2 places?


Or maybe just add a groupid field to the user table?
 
Last edited:
0
•••
after looking at your pm, is this the sql you want?

PHP:
$sqlstr = "SELECT u.uid, u.uname, g.groupid FROM ".$db->prefix("users")." AS u, ".$db->prefix("user_group_link")." AS g WHERE u.uid = g.uid AND g.groupid =4";
 
1
•••
i think that did it once I changed it to groups_users_link :) I still need to limit the result but I think I can handle that part . Thanks a bunch. There will be some more stuff I need to do im sure this thread should stay open..lol
 
0
•••
I do have another question.

Lets say I have a list of 10 people and i would like people to post a bulletin on a site such as myspace, Like a train script. how would I go about doing that?

All I really need is something what will display the code and the bottom of a page that a user can copy/paste into a bulletin

could I use any information from my above posts to do that?


any ideas?
 
0
•••

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back