Rate this article |
Retrieving Values from SQL Select in a Trigger |
Rating: 5.0/5 (2 votes cast) |
|
Get the values from a SQL statement within an ADDT trigger that do not
exist within the original transaction.
$querySEL = "SELECT
dbfield1, dbfield2 FROM table"; $result =
$tNG->connection->execute($querySEL); $numberOfRecords =
$result->recordCount(); ...... while (!$result->EOF) { $result->Fields('dbfield1'); $result->Fields('dbfield2'); $result->MoveNext(); } }
----- 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.
|