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.

Adobe

ionCube Online PHP Encoder
XMS Systems
Free PositiveSSL and WhoisGuard with Every Domain Purchase

Although we try to ensure all the articles submitted are valid it is your responsibility to make sure you have backups before you use these suggestions on your pc or websites.
We do not take any responsibility for any data-loss, loss in functionality or any problem that might arise in what-ever way or form by making use of the information on this site.

"Friends of Interakt" has no connection to the Adobe Interakt Company