so i was writing code about deleting a post so i use this code
require_once 'core/init.php';
if (isset($_GET['id'])) {
if (hapus_data($_GET['id'])) {
header('Location: index.php');
}else {
echo "gagal menghapus data";
}
}
and here is the delete function
function hapus_data($id){
$query = "DELETE FROM blog WHERE id = $id";
return run($query);
}`
so what i didnt understand is why this code work but the parameters is not the same as you can see i put hapus_data($_GET['id'] and then hapus_data($id) as the parameter of the function