| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| NamePros Member | 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, ";
}
?>
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 |
| |
| | #2 (permalink) |
| NamePros Member | 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, ";
}
?>
|
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |