Brononius Posted August 19, 2013 Share Posted August 19, 2013 Hey, I've created a database where my users (joomla users and CB) can point out that they would like to recieve emails.This code gives me a nice overview of all the users their email, and with the echo I putted a , in between. $result = mysql_query("SELECT email FROM voc_users LEFT JOIN voc_comprofiler ON voc_users.id = voc_comprofiler.user_id WHERE cb_mailing =1"); while ($row = mysql_fetch_assoc($result)) { echo "" . $row['email'] . ", "; } But I would like to put the echo now in a variable (?) so that I can use this later on in a mailform. Any ideas/suggestion how I should do this? Thanks! Link to comment https://forums.phpfreaks.com/topic/281368-mysql-lookup-into-mailform-mailto/ Share on other sites More sharing options...
Barand Posted August 19, 2013 Share Posted August 19, 2013 Store in an array while ....... { $mailarray[] = $row['email']; } Link to comment https://forums.phpfreaks.com/topic/281368-mysql-lookup-into-mailform-mailto/#findComment-1445863 Share on other sites More sharing options...
Brononius Posted August 20, 2013 Author Share Posted August 20, 2013 Hey, When I put this in array, I only have the latest email adres returned. :$ And I would like to have all adresses that have the option 1 selected ([email protected], [email protected], mai.....) ps maybe it has something to do with the chronoengine I'm using under joomla? This is the code so far: $result = mysql_query(" SELECT email FROM voc_users LEFT JOIN voc_comprofiler ON voc_users.id = voc_comprofiler.user_id WHERE cb_mailing = 1 "); while ($row = mysql_fetch_assoc($result)) { $form->data['mailarray'] = $row['email']; } Link to comment https://forums.phpfreaks.com/topic/281368-mysql-lookup-into-mailform-mailto/#findComment-1445928 Share on other sites More sharing options...
Barand Posted August 20, 2013 Share Posted August 20, 2013 Or maybe it's to do with your writing all values to the same array key instead of appending to the array as my code would Link to comment https://forums.phpfreaks.com/topic/281368-mysql-lookup-into-mailform-mailto/#findComment-1445936 Share on other sites More sharing options...
Brononius Posted August 20, 2013 Author Share Posted August 20, 2013 Ahhh, this should be better, no? $result = mysql_query(" SELECT email FROM voc_users LEFT JOIN voc_comprofiler ON voc_users.id = voc_comprofiler.user_id WHERE cb_mailing = 1 "); while ($row = mysql_fetch_array($result)) { $mailarray[] = $row['email']; } $form->data['BCC_mail'] = $mailarray; Link to comment https://forums.phpfreaks.com/topic/281368-mysql-lookup-into-mailform-mailto/#findComment-1445942 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.