Page 1 of 1

Update function

Posted: Tue Mar 23, 2010 8:57 pm
by 8707

Code: Select all

function updateHelpDeskSC($focusId, $entityIds) {
        
        if(!is_array($entityIds)) $entityIds = array($entityIds);
        $selectTicketsQuery = "SELECT ticketid FROM vtiger_troubletickets WHERE (servicecontractsid IS NULL OR servicecontractsid = 0) AND ticketid IN (" . generateQuestionMarks($entityIds) .")";
        $selectTicketsResult = $this->db->pquery($selectTicketsQuery, array($entityIds));
        $noOfTickets = $this->db->num_rows($selectTicketsResult);
        for($i=0; $i < $noOfTickets; ++$i) {
            $ticketId = $this->db->query_result($selectTicketsResult,$i,'ticketid');
            $updateQuery = "UPDATE vtiger_troubletickets SET servicecontractsid=vtiger_servicecontracts.servicecontractsid" .
                        " WHERE vtiger_servicecontracts.servicecontractsid = ? AND vtiger_troubletickets.ticketid = ?";         
            $updateResult = $this->db->pquery($updateQuery, array($focusId, $ticketId));
        }
        
    }
Above function is use to update the servicecontractsid of ticket with servicecontractsid of ServiceContracts if the id is empty. But it just cannot execute successfully! So hope someone can help me to fix it!!
TQ

Re: Update function

Posted: Tue Apr 06, 2010 11:41 am
by andyhoneycutt
Would you please post the mysql and/or php error(s) you are receiving? This would go a long way to troubleshooting the problem. If needed, check your apache and mysql error logs.