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 Querys

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 11-03-2005, 09:21 PM THREAD STARTER               #1 (permalink)
NamePros Member
Join Date: May 2005
Location: Portsmouth, UK
Posts: 191
Cooper is on a distinguished road
 



Caution Querys


I'm running IPB 1.3 Final
I wrote this simple script to get members e-mail addresses from my forums database.
Code:
<?PHP
//Connect to DB
mysql_pconnect("localhost","cooper","password");
mysql_select_db("cooper_forum");

//Tell the script what to look for and where
$result = mysql_query("SELECT email FROM `ipbmembers`");

//Tell Script what infromation to collect
while($r=mysql_fetch_array($result)) 
{
$email = $r["email"];

//Display info
print "$email, ";

}
?>
Now i need it to somehow link with `ipbpfields_content`so that if "field_2" = "n" then the members email address is not displayed when the query is run.

I'm new to PHP and not sure how to do it. Any advice on how then that would be great
__________________
:kickass: Brand New Media Site Script MyMediaScript.com:kickass:
Alpha Web Directory - Permanent $15 Solid PR3 Inner Pages
Burnout 5
Cooper is offline  
Old 11-10-2005, 04:07 PM   #2 (permalink)
NamePros Member
Join Date: Nov 2005
Posts: 122
cytech will become famous soon enough
 



Hey there.

Give this a go:

Code:
<?PHP
//Connect to DB
mysql_pconnect("localhost","cooper","password");
mysql_select_db("cooper_forum");

//Tell the script what to look for and where
$result = mysql_query("SELECT m.email,i.field_2 FROM ipbmembers AS m LEFT JOIN ipbmembers AS i ON i.UNIQUEID=m.UNIQUEID");

//Tell Script what infromation to collect
while($r=mysql_fetch_array($result)) 
{
if($r[field_2]!="n"){
$email = $r["email"];
}

//Display info
print "$email, ";

}
?>
Where I have UNIQUEID be sure to place the unique identifier.
__________________
CYTechnologies - Professional Website Development and Design

GetCustomerRated.com - Get Customer Rated allows a business to capture genuine word of mouth advertising and place it in a virtual player on their website.
cytech 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 05:07 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