This topic is locked

Updating Another Table

4/26/2013 8:00:35 PM
PHPRunner General questions
S
swanside author

I have a table I need to update when another table has been update.

In my dtdimports, there is a checkbox for Print, to show that the record has been printed. It is edited by the user in the edit screen.

I also have a timesheet table, and I have a print field here as well.

When the user goes to the edit page in the dtdimports and checks the Print button and saves it, I need the Checkbox in the timesheet table for the same ID to also show that the checkbox for Print its checked.

I have tried this code



8 global $conn;

9 $strSQLInsert = "UPDATE timesheet

10 SET `Print` = 1

11 WHERE dtdimports.reportGuid = timesheet.oldreportguid";

12

13 db_exec($strSQLInsert,$conn);


Can anybody help please?

Cheers

Paul.

C
cgphp 4/27/2013

In the "After record updated" event of the dtdimports edit page, enter the following code:



if($values['Print'] == 1)

{

global $conn;

$strSQLUpdate = "UPDATE timesheet SET Print = 1 WHERE oldreportguid = " . $values['reportGuid'];

db_exec($strSQLUpdate, $conn);

}
S
swanside author 4/30/2013



In the "After record updated" event of the dtdimports edit page, enter the following code:



if($values['Print'] == 1)

{

global $conn;

$strSQLUpdate = "UPDATE timesheet SET Print = 1 WHERE oldreportguid = " . $values['reportGuid'];

db_exec($strSQLUpdate, $conn);

}




Thanks Cristian

I will try that when I get home, My current internet connection is slower than the old dial up, so its not worth me trying it out yet.
Regards

Paul