Hi.
i have 2 tables in a list view that i need to compare data between them:
<ol> sent list - tblEmailCampaign waiting to be send - tblContactComm
</ol>i need an indication at my list of "waiting to be send" from the "sent list" if it was Sent or UnSubscribe.
the result will be as a cell color at the "waiting to be send" (tblContactComm).
I already made it as a nested while, and got the result.
My problem is to impliment the result in "After record processed" event in my "waiting to be send" list.
The result should be as a background color of "last_campaign" column.
Right now my code doesnt do that and i get this error:
Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /home/classes/runnerpage.php:1944 Stack trace: #0 /home/classes/runnerpage.php(1931): RunnerPage->spreadRowStyle() #1 /home/classes/listpage.php(1658): RunnerPage->spreadRowStyles() #2 /home/classes/listpage.php(2213): ListPage->fillGridData() #3 /home/tblcontactcommsendit_list.php(158): ListPage->prepareForBuildPage() #4 {main} thrown in /home/classes/runnerpage.php on line 1944
This is my code:
//retrive already sent records that identify by email_id (the contact man email) ant the email subject_id.
//the sent_id indicate that it was sent or unsubscribe
$sql = "SELECT subject_id, email_id, sent_id FROM tblEmailCampaign";
$myresult = DB::Query($sql);
$myrow = array();
while ($row = $myresult->fetchAssoc()) {
$subjectId = $row['subject_id'];
$emailId = $row['email_id'];
$sentId = $row['sent_id'];
`// Fetch records from tblContactComm-the new list to be sent. here we want to see the indication from tblEmailCampaign
//the indication will be as a background color of the cell last_campaign: yellow-sent, red-unsubscribe
$sqlContactComm = "SELECT * FROM tblContactComm WHERE last_campaign != 0 AND last_campaign != '' AND last_campaign IS NOT NULL";
$myresult1 = DB::Query($sqlContactComm);
$myrow1 = array();
while ($record = $myresult1->fetchAssoc()) {
// Retrieve the last_campaign and CustomerCommID values for the current record
$currentLastCampaign = $record['last_campaign'];
$currentCustomerCommID = $record['CustomerCommID'];
// Check if the values match the tblEmailCampaign table record
if ($currentLastCampaign == $subjectId && $currentCustomerCommID == $emailId) {
// Change the background color and font color of the last_campaign field based on the sent_id field value
if ($sentId == 1) {
$record["last_campaign_css"] .= 'background: yellow;';
} elseif ($sentId == 3) {
$record["last_campaign_css"] .= 'background: red;';
}
}
$myrow1[] = $record;
}
$myrow = $myrow1;`}
anyone has an idea how to solve it ?