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

	if(isset($_GET['id'])){
		$sql = "DELETE FROM testimonials WHERE id = '".$_GET['id']."'";

		//use for MySQLi OOP
		if($conn->query($sql)){
			$_SESSION['success'] = 'Testimonial deleted successfully';
		}
		////////////////

		//use for MySQLi Procedural
		// if(mysqli_query($conn, $sql)){
		// 	$_SESSION['success'] = 'Member deleted successfully';
		// }
		/////////////////
		
		else{
			$_SESSION['error'] = 'Something went wrong in deleting testimonial';
		}
	}
	else{
		$_SESSION['error'] = 'Select testimonial to delete first';
	}

	header('location: index.php');
?>