function insertRecord() { $sql = sprintf("insert into %s (" . " rptopNumber" . ", rptopDate" . ", taxableYear" . ", cityTreasurer" . ", cityAssessor" . ", dateCreated" . ", createdBy" . ", dateModified" . ", modifiedBy" . ", archive" . ") " . "values (" . " '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'" . ");", RPTOP_TABLE, fixQuotes($this->rptopNumber), fixQuotes($this->rptopDate), fixQuotes($this->taxableYear), fixQuotes($this->cityTreasurer), fixQuotes($this->cityAssessor), fixQuotes(time()), fixQuotes($this->createdBy), fixQuotes(time()), fixQuotes($this->modifiedBy), fixQuotes($this->archive)); //echo $sql; $this->setDB(); $this->db->beginTransaction(); $this->db->query($sql); $rptopID = $this->db->insert_id(); if ($this->db->Errno != 0) { $this->db->rollbackTransaction(); $this->db->resetErrors(); $ret = false; } else { $owner = new Owner(); $owner->insertRecord($rptopID, "rptop"); $this->db->endTransaction(); $ret = $rptopID; } return $ret; }
function insertRecord() { $sql = sprintf("insert into %s (" . " landArea" . ", houseTagNumber" . ", lotNumber" . ", zoneNumber" . ", blockNumber" . ", psd13" . ", affidavitOfOwnership" . ", barangayCertificate" . ", landTagging" . ", dateCreated" . ", createdBy" . ", dateModified" . ", modifiedBy" . ", archive" . ", transactionCode" . ") values ('%s','%s','%s','%s','%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s');", OD_TABLE, fixQuotes($this->landArea), fixQuotes($this->houseTagNumber), fixQuotes($this->lotNumber), fixQuotes($this->zoneNumber), fixQuotes($this->blockNumber), fixQuotes($this->psd13), fixQuotes($this->affidavitOfOwnership), fixQuotes($this->barangayCertificate), fixQuotes($this->landTagging), fixQuotes(time()), fixQuotes($this->createdBy), fixQuotes(time()), fixQuotes($this->modifiedBy), fixQuotes($this->archive), fixQuotes($this->transactionCode)); $this->setDB(); $this->db->beginTransaction(); $this->db->query($sql); $odID = $this->db->insert_id(); if ($this->db->Errno != 0) { $this->db->rollbackTransaction(); $this->db->resetErrors(); $ret = false; } else { $this->db->endTransaction(); $owner = new Owner(); $this->newOwnerID = $owner->insertRecord($odID, "od"); if (is_a($this->locationAddress, LocationAddress)) { $locationAddressID = $this->locationAddress->insertRecord(); $sql = sprintf("insert into %s (" . "odID" . ", locationAddressID" . ") values ('%s', '%s');", LOCATION_TABLE, fixQuotes($odID), fixQuotes($locationAddressID)); $this->db->beginTransaction(); $this->db->query($sql); $locationID = $this->db->insert_id(); if ($this->db->Errno != 0) { $this->db->rollbackTransaction(); $this->db->resetErrors(); $ret = false; } else { $this->db->endTransaction(); } } foreach ($this->oldODArray as $key => $value) { $sql = sprintf("insert into %s (" . "previousOdID" . ", presentOdID" . ", transactionCode" . ") values ('%s', '%s', '%s');", ODHISTORY_TABLE, fixQuotes($value), fixQuotes($odID), fixQuotes($this->transactionCode)); $this->db->beginTransaction(); $this->db->query($sql); $locationID = $this->db->insert_id(); if ($this->db->Errno != 0) { $this->db->rollbackTransaction(); $this->db->resetErrors(); $ret = false; } else { $this->db->endTransaction(); } } $ret = $odID; } return $ret; }