seany123 Posted February 4, 2010 Share Posted February 4, 2010 im trying to make a mass mail page wher i can mass mail everyone but im not too sure how to do it... this is what i would do to message 1 person. $query = $db->execute("insert into `mail` (`to`, `from`, `body`, `subject`) values (?, ?, ?, ?)", array($insert['to'], $insert['from'], $insert['body'], $insert['subject'])); the members are stored in member table so basically what i think need to do is: $query = $db->execute("SELECT id FROM members"); $member = $query->fetchrow(){ $query = $db->execute("insert into `mail` (`to`, `from`, `body`, `subject`) values (?, ?, ?, ?)", array($member, $insert['from'], $insert['body'], $insert['subject'])); } is that right? Quote Link to comment Share on other sites More sharing options...
trq Posted February 4, 2010 Share Posted February 4, 2010 Surely you will need to loop through the results of your query. Quote Link to comment Share on other sites More sharing options...
seany123 Posted February 4, 2010 Author Share Posted February 4, 2010 $query = $db->execute("SELECT id FROM members"); while($member = $query->fetchrow()){ $query = $db->execute("insert into `mail` (`to`, `from`, `body`, `subject`) values (?, ?, ?, ?)", array($member, $insert['from'], $insert['body'], $insert['subject'])); } ?? Quote Link to comment Share on other sites More sharing options...
trq Posted February 4, 2010 Share Posted February 4, 2010 Even then, I would assume $member is an array. Try... $query = $db->execute("insert into `mail` (`to`, `from`, `body`, `subject`) values (?, ?, ?, ?)", array($member['id'], $insert['from'], $insert['body'], $insert['subject'])); 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.