<?php

	
	$p_barcode =  $_GET['id'];
	
	$conn = new mysqli('localhost', 'root', 'tester123','book_store');
	if ($conn->connect_error) {
		die("Connection failed: " . $conn->connect_error);
	}else{
		//echo "ok";
	}
	
	
	if($p_barcode != ""){		
		$sql = "DELETE FROM patrons WHERE p_barcode='".$p_barcode."'";
		echo $sql;
		if ($conn->query($sql) === TRUE) {
			echo "Record deleted successfully";
		} else {
			echo "Error deleting record: " . $conn->error;
		}
	}
	 header( "location: http://127.0.0.1/booking/patrons.php" );
	
	$conn->close();
?>