<?php 

include_once("../classes/database.class.php");

$db = new database();

if (isset($_POST['action'])) {
	# code...
	$action = $_POST['action'];

	if ($action == 'tickersetting') {
		# code...
		$uid = $_POST['uid'];

		$vl = $_POST['vl'];

		$get = $db->db->prepare("SELECT * FROM tickersetting WHERE user = '$uid'");
		$get->execute();
		$fetchTickerUser = $get->fetch();

		if (empty($fetchTickerUser)) {
			# code...
			$insert = $db->db->prepare("INSERT INTO tickersetting(user, ticker) VALUES ('$uid', '$vl')");
			$insert->execute();
		}else{

			$update = $db->db->prepare("UPDATE tickersetting SET ticker = '$vl' WHERE user = '$uid'");
			$update->execute();
		}
	}
}

?>