franklin664 Posted November 22, 2003 Share Posted November 22, 2003 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 Quote Link to comment https://forums.phpfreaks.com/topic/1409-extracting-an-email-list-from-mysql-database/ Share on other sites More sharing options...
shivabharat Posted November 22, 2003 Share Posted November 22, 2003 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; ?> Quote Link to comment https://forums.phpfreaks.com/topic/1409-extracting-an-email-list-from-mysql-database/#findComment-4680 Share on other sites More sharing options...
franklin664 Posted November 25, 2003 Author Share Posted November 25, 2003 Thanks this worked great Quote Link to comment https://forums.phpfreaks.com/topic/1409-extracting-an-email-list-from-mysql-database/#findComment-4710 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.