SELECT TABLE_NAME, COLUMN_NAME, CONSTRAINT_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME 
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE 
WHERE REFERENCED_TABLE_NAME = 'per_supplier' 
AND TABLE_SCHEMA = 'san_5des';
//api js
fetch("https://demo.mayagrahakencana.com/san_5des/auth/API/ModulConnect/cp_data")
    .then(response => response.json()) // Parsing otomatis ke JSON
    .then(data => console.log(data))   // Menampilkan data di console
    .catch(error => console.error("Error:", error));

SELECT 
    transaksi_id, 
    COUNT(*) AS jumlah
FROM  __rek_pembantu_supplier__2010010
WHERE 
    extern_id = '1'
GROUP BY transaksi_id
HAVING COUNT(*) > 1;

$this->db->select_max('counter');
$this->db->where('jenis', 'supplies'); // filter hanya jenis supplies
$query = $this->db->get('produk');

$row = $query->row();
$last_counter = $row ? $row->counter : 0;

$data = [
    'nama_produk' => $this->input->post('nama_produk'),
    'jenis'       => 'supplies',
    'harga'       => $this->input->post('harga'),
    'counter'     => $last_counter + 1,
];

$this->db->insert('produk', $data);