Max and Steven,
Thanks for responding so quickly. Unfortunately, I still can't get it to work properly.
If I copy Steven's code into the procedure and try to run it, I get a blank screen.
If I remove the first line, and change '#dataTable#' to 'violations' I still get a blank screen.
If I remove the first line, change '#dataTable#' to 'violations' and remove the ';' before the second parentheses, then it works.
So this is what it looks like now:
Code: Select all
$resultSet = nuRunQuery("SELECT * from violations "); //-- this will work
while ($violations_id = db_fetch_object($resultSet)) {
echo "Date 1 - ".$violations_id->vio_date_entered_1.", "."Date 2 - ".$violations_id->vio_date_entered_2."\n";
echo "<br>\n";
}
I also tried the following code from Max:
Code: Select all
$sql = "CREATE TABLE #dataTable# SELECT * from violations ";
nuDebug($sql);
nuRunQuery($sql);
$resultSet = nuRunQuery("SELECT * from #dataTable# "); //-- this will work
while ($violations_id = db_fetch_object($resultSet)) {
echo "Date 1 - ".$violations_id->vio_date_entered_1.", "."Date 2 - ".$violations_id->vio_date_entered_2."\n";
echo "<br>\n";
}
and received this error in zzsys_trap:
(nuBuilder Procedure Code) of Test code Using Activity Procedure : Error Reference: 6774d72
An error occurred while running the following query:
CREATE TABLE #dataTable# SELECT * from violations
I thought maybe I was spelling 'violations' wrong but it works fine in the '$resultSet' line.
Finally, I appreciate the comment by Steven,
BTW there is never any need to use #dataTable# in a procedure as the result has no report or export to go to.
What I am trying to do is test my logic for a report. In the report I want to use #dataTable# to get data from one or more tables, add some temporary fields, make some calculations and then update those temporary fields before creating the report.
I appreciate any suggestions you may have.
John