<?php
defined('BASEPATH') or exit('No direct script access allowed');

require_once dirname(__FILE__) . '/../Exhibition_Model.php';

class Da_company extends Exhibition_Model
{

	public function __construct()
	{
		parent::__construct();
	}

	public function insert_company($name, $image)
	{
		$sql = "INSERT INTO {$this->db_name}.company 
		(
            name,
			image
        )
        VALUES (?,?);";
        $this->db->query($sql, [$name, $image]);       
	}

	public function update_company($name, $image, $id)
	{
		$sql = "UPDATE {$this->db_name}.company
        SET name = ?,
		image = ?
        WHERE company_id = ?";
        $this->db->query($sql, [$name, $image, $id]);
	}

	public function update_company_no_image($name, $id)
	{
		$sql = "UPDATE {$this->db_name}.company
        SET name = ?
        WHERE company_id = ?";
        $this->db->query($sql, [$name, $id]);
	}

	public function delete_company($id)
	{
		$sql = "UPDATE {$this->db_name}.company
        SET is_delete = ?
        WHERE company_id = ?";
        $this->db->query($sql, [1, $id]);
	}

}
