Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Update: After Save

Post Reply
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Update: After Save

Unread post by ruiascensao »

Hi,
I'm trying to update another table when I'm saving a record:

Code: Select all

$batID = $formValue['jbatch_id'];
nuRunQuery("UPDATE batch SET batch_maf = (SELECT SUM(jobs_fmaj) FROM jobs where jbatch_id='$batID' ) where batch_id ='$batID'");
nuRunQuery("UPDATE batch SET batch_mif = (SELECT SUM(jobs_fmin) FROM jobs where jbatch_id='$batID' ) where batch_id ='$batID'");

$faultsnum = nuRunQuery("SELECT * FROM batch WHERE batch_id = '$batID'");
$r=db_fetch_object($faultsnum);
$faultmaj = $r->batch_maf;
$faultmin = $r->batch_mif;
                if ($faultmaj>0 || $faultmin>1){
                       $batST = 'Failed';
       } else {
                       $batST = 'Passed';
                }
nuRunQuery("UPDATE batch SET batch_status ='$batST' where batch_id ='$batID'");
I'm running this code in "Jobs" form/table to update "batch" table.
But it doesn't work.

What I'm doing wrong????

Thank You,

Best Regards,
Rui
BR
Rui
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Update: After Save

Unread post by admin »

Rui,

Which line is it falling over on?

use nuDebug to find out.

Steven
Post Reply