[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

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


Closed Thread
 
LinkBack Thread Tools
Old 02-24-2007, 09:09 AM   #1 (permalink)
Senior Member
 
Join Date: Nov 2003
Location: Florida
Posts: 2,010
117.50 NP$ (Donate)

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 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
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, 09:19 AM   #2 (permalink)
Barru.
 
Barrucadu's Avatar
 
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,731
78.50 NP$ (Donate)

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
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 online now  
Old 02-24-2007, 09:38 AM   #3 (permalink)
Senior Member
 
Join Date: Nov 2003
Location: Florida
Posts: 2,010
117.50 NP$ (Donate)

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 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 09:42 AM.
slipondajimmy is offline  
Old 02-24-2007, 10:59 AM   #4 (permalink)
Barru.
 
Barrucadu's Avatar
 
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,731
78.50 NP$ (Donate)

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";
Barrucadu is online now  
Old 02-24-2007, 11:13 AM   #5 (permalink)
Senior Member
 
Join Date: Nov 2003
Location: Florida
Posts: 2,010
117.50 NP$ (Donate)

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 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, 02:56 PM   #6 (permalink)
Senior Member
 
Join Date: Nov 2003
Location: Florida
Posts: 2,010
117.50 NP$ (Donate)

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 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

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 11:39 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85