<?php
	session_start();
	include_once('../../db/saucerer.php');

	if(isset($_GET['id'])){
		$sql = "UPDATE listings SET deleted = '1' WHERE id = '".$_GET['id']."'";

		//use for MySQLi OOP
		if($conn->query($sql)){
			$_SESSION['success'] = ''.$_GET['title'].' deleted successfully';
		}
		
		else{
			$_SESSION['error'] = 'Something went wrong while deleting '.$_GET['title'].'!';
		}
	}

	header('location: ../');
?>