kev wood Posted March 6, 2009 Share Posted March 6, 2009 i am trying to create an array of email address stored in a mysql db and store the result into a php variable to be used in the BCC section of an email. up to now the code i am using is only placing one email address into the php variable. here is the code $query = "SELECT email FROM emails"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { $contactemail = $row['email']; } arrays are not my strong point as you can prob tell from the code i have written. Quote Link to comment https://forums.phpfreaks.com/topic/148227-array-not-being-populated/ Share on other sites More sharing options...
Mchl Posted March 6, 2009 Share Posted March 6, 2009 You're assigning a value to a variable. Use code below to fill in array. $contactemail[] = $row['email']; Quote Link to comment https://forums.phpfreaks.com/topic/148227-array-not-being-populated/#findComment-778137 Share on other sites More sharing options...
jackpf Posted March 6, 2009 Share Posted March 6, 2009 Lol Mchl beat me to it. Just wondering, why do you need it in an array anyway? Can't you just perform the action you wish to perform in the while() loop? Quote Link to comment https://forums.phpfreaks.com/topic/148227-array-not-being-populated/#findComment-778141 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.