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

	if(isset($_POST['edit'])){
		$id = $_POST['id'];
		$name = $_POST['name'];
		$email = $_POST['email'];
		$comments = $_POST['comments'];
		$rating = $_POST['rating'];
		$image = $_POST['image'];
		
		$sql = "UPDATE comments SET name = '$name', email = '$email', comments = '$comments', rating = '$rating', image = '$image' WHERE id = '$id'";

		//use for MySQLi OOP
		if($conn->query($sql)){
			$_SESSION['success'] = 'Comment updated successfully';
		}
		
		
		else{
			$_SESSION['error'] = 'Something went wrong in updating brand';
		}
	}

	header('location: ../');

?>