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; } 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. 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. Link to comment https://forums.phpfreaks.com/topic/259713-not-inserting/page/2/#findComment-1331349 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.