<?php
session_start();
include_once "../../../config.php";
include_once "../../database1.php";
include_once "../../../validation.php";
include_once "../../../Helper.php";
require_once '../check_edit_page_ajax.php';

class banner2_link_upload extends database{
    public function index($link, $id)
    {
            return $this->update('tb_product_category_banners2', ['cl_link' => $link], ['cl_id' => $id]);
    }
}

if(!isset($_POST['link']))
{
    http_response_code(500);
	echo json_encode(array('error_text' => 'Something Went Wrong'));
	exit;
}

$link = $_POST['link'];
if(trim($link) == '')
{
    http_response_code(400);
	echo json_encode(array('error_text' => 'PLease enter value for link or #'));
	exit;
}



$obj = new banner2_link_upload();
$res = $obj->index($link, $id);
if(!$res)
{
	http_response_code(500);
	echo json_encode(array('error_text' => 'Something Went Wrong While Adding File User. Please try again'));
	exit;
}

http_response_code(200);
echo json_encode(array('message' => 'URL Updated Successfully'));
exit;