This content has been marked as final. Show 3 replies
I figured it out using the KT_Recordset class. Very obscure the lack of documentation.
Please could you post an example of how you did it, as this would be very helpfull for me and i suspect many others.
here is how it works (I cut out other portions of the code that did other non-related logic:
$queryEmail = "SELECT dpccVolunteers.HomeEmail, dpccVolunteerToFunction.*, dpccFunctions.Name, dpccVolunteers.FirstName, dpccVolunteers.LastName FROM ((dpccVolunteers LEFT JOIN dpccVolunteerToFunction ON dpccVolunteerToFunction.VolunteerID=dpccVolunteers.ID) LEFT JOIN dpccFunctions ON dpccFunctions.ID=dpccVolunteerToFunction.FunctionID) WHERE dpccFunctions.Name='Contact Information' ";
$result = $tNG->connection->execute($queryEmail);
$numberOfRecords = $result->recordCount();
$mail->AddAddress($result->Fields('HomeEmail'), $result->Fields('FirstName')." ".$result->Fields('LastName'));
So the important functions are $result->EOF which indicates you perused all records. To retrieve a column from the current row use $result->Fields('>>>fieldname<<<')
To get to the next row, use $result->MoveNext(). There is also a MoveFirst function, just in case you need to read all rows again.
You can call Close() at the end but reading the code it does nothing so you might as well omit it.
Hope that helps.