NameSilo

Querys

SpaceshipSpaceship
Watch

Cooper

Established Member
Impact
2
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 :tu:
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
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. :)
 
0
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back