Jump to content


Photo

Extracting an email list from mysql database.


  • Please log in to reply
2 replies to this topic

#1 franklin664

franklin664
  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 22 November 2003 - 01:39 AM

Hello I have a database that has a table that holds name, email and location and i was wondering how would i exteract all the emails but not the name and locations into a comma seperated list or even better a semi colon seperated list. So i can send a bulk email to them.

Thanks

#2 shivabharat

shivabharat
  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 22 November 2003 - 03:32 PM

Try this

<?php $sql = mysql_query("select email from table_name"); $count = mysql_num_rows($sql);$c=0;while ($row = mysql_fetch_array($sql)) {                 $b=$row[0];	                 if ( $c < ($count-1))	{                             $a = $a.$b.\';\';	}	else	{  $a = $a.$b;	}	$c++;}  echo $a;?>

Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks

#3 franklin664

franklin664
  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 25 November 2003 - 08:01 PM

Thanks this worked great




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users