print_table_style(); $sql = "select M_BranchID, M_BranchCode, M_BranchName, TxBranchStatusM_BranchIP TxIpAddress, M_BranchIPAddress, count(*) total from tx_branch_status join m_branch on TxBranchStatusIsSent = 'N' and TxBranchStatusM_BranchID = M_BranchID group by M_BranchCode, TxBranchStatusM_BranchIP "; $qry = $this->db->query($sql); if (!$qry) { echo "ERR : " . $this->db->error()["message"] . "\n"; exit(); } $rows = $qry->result_array(); foreach ($rows as $idx => $r) { $branchID = $r["M_BranchID"]; $branchIP = $r["M_BranchIPAddress"]; $action = "Fix IP and Retry"; $rows[$idx]["Action"] = $action; } $this->print_table($rows, array_keys($rows[0]), "Tx Branch Status"); } function fix($branchID, $branchIP) { $sql = "update tx_branch_status set TxBranchStatusRetry =1 , TxBranchStatusM_BranchIP = ? where TxBranchStatusIsSent = 'N' and TxBranchStatusM_BranchID = ? "; $qry = $this->db->query($sql, [$branchIP, $branchID]); if (!$qry) { echo "ERR : " . $this->db->error()["message"] . "\n"; exit(); } header("Location: /one-api/fix/tx_branch"); exit(); } public function print_table_style() { echo " "; } public function print_table($rows, $keys, $title = false) { echo ""; if ($title) { $col_span = count($keys); echo ""; echo ""; echo ""; } echo ""; foreach ($keys as $k) { echo ""; } echo "\n"; foreach ($rows as $r) { echo ""; foreach ($keys as $k) { echo ""; } echo ""; } echo "
$title
$k
" . $r[$k] . "
"; } } ?>