NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page PHP Question

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 02-24-2007, 10:09 AM THREAD STARTER               #1 (permalink)
Senior Member
Join Date: Nov 2003
Location: Florida
Posts: 2,026
slipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to behold
 



PHP Question


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
????: NamePros.com http://www.namepros.com/programming/298094-php-question.html
WHERE pop_users.uid = pop_groups_users_link.uid
AND groupid =4


This pulls the info I need.


Any help would be great.
slipondajimmy is offline  
Old 02-24-2007, 10:19 AM   #2 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
 




In php you will need to use the mysql_query function:
PHP Code:
<?php
????: NamePros.com http://www.namepros.com/showthread.php?t=298094
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();
?>
Barrucadu is offline  
Old 02-24-2007, 10:38 AM THREAD STARTER               #3 (permalink)
Senior Member
Join Date: Nov 2003
Location: Florida
Posts: 2,026
slipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to behold
 



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 by slipondajimmy; 02-24-2007 at 10:42 AM.
slipondajimmy is offline  
Old 02-24-2007, 11:59 AM   #4 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
 




after looking at your pm, is this the sql you want?

PHP Code:
$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"
????: NamePros.com http://www.namepros.com/showthread.php?t=298094
Barrucadu is offline  
Old 02-24-2007, 12:13 PM THREAD STARTER               #5 (permalink)
Senior Member
Join Date: Nov 2003
Location: Florida
Posts: 2,026
slipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to behold
 



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
slipondajimmy is offline  
Old 02-24-2007, 03:56 PM THREAD STARTER               #6 (permalink)
Senior Member
Join Date: Nov 2003
Location: Florida
Posts: 2,026
slipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to beholdslipondajimmy is a splendid one to behold
 



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?
slipondajimmy is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 08:31 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger