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! Quote Link to comment 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']; } Quote Link to comment 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 (mail1@dom.com, mail2@dom.org, 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']; } Quote Link to comment 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 Quote Link to comment 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; Quote Link to comment 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.