dudejma Posted January 21, 2012 Share Posted January 21, 2012 I keep getting the "Invalid arguments passed in..." error when trying to use implode. Here's the code: $getPilots = "SELECT * FROM users WHERE emailOption = '1' AND status = '1'"; $runGetPilots = mysql_query($getPilots); while ($info = mysql_fetch_array($runGetPilots)) { $emails = $info['email']; $to = implode(', ', $emails); The ending bracket is there, i just didn't include it in the code. Any suggestions? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/255488-implode/ Share on other sites More sharing options...
AyKay47 Posted January 21, 2012 Share Posted January 21, 2012 $emails holds the value of $info['email'], which is a string, implodes()'s second parameter requires an array. what you can do, if you want to implode only the emails field, is something like this. $emails_arr = array(); while ($info = mysql_fetch_array($runGetPilots)) { $emails_arr[] = $info['email']; } $to = implode(', ', $emails_arr); Quote Link to comment https://forums.phpfreaks.com/topic/255488-implode/#findComment-1309908 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.