Xtremer360 Posted March 26, 2012 Author Share Posted March 26, 2012 I reworked the function just a little and came up with this but want to know how to handle the fact of if the inserts are ran successfully or not with returning TRUE or FALSE. function sendMessage($recipients, $bcc, $subject, $message, $sender) { $data = array( 'subject' => $subject, 'senderID' => $sender, 'message' => $message ); $this->db->insert('usersPersonalMessages', $data); $insertID = $this->db->insert_id(); foreach ($recipients as $recipientID) { $recipientData = array ( 'userID' => $recipientID, 'usersPersonalMessagesID' => $insertID ); $this->db->insert('usersPersonalMessagesRecipients', $recipientData); } if ($bcc) { foreach ($bcc AS $bccID) { $bccData = array ( 'userID' => $bccID, 'usersPersonalMessagesID' => $insertID ); $this->db->insert('usersPersonalMessagesRecipients', $bccData); } } return TRUE; } Quote Link to comment https://forums.phpfreaks.com/topic/259713-not-inserting/page/2/#findComment-1331315 Share on other sites More sharing options...
Xtremer360 Posted March 26, 2012 Author Share Posted March 26, 2012 I did some testing and am now to the point where what if bcc doesn't contain anything. Quote Link to comment https://forums.phpfreaks.com/topic/259713-not-inserting/page/2/#findComment-1331331 Share on other sites More sharing options...
AyKay47 Posted March 26, 2012 Share Posted March 26, 2012 If this is solved, please post the solution. Quote Link to comment https://forums.phpfreaks.com/topic/259713-not-inserting/page/2/#findComment-1331349 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.