<?php require('includes/connect.php'); $did = $_GET['delete']; if(isset($did)) { $username = $_SESSION['username']; $query = mysql_query("SELECT * FROM `poem` WHERE `id` = '$did' AND `author` = '$username'") or die(mysql_error()); if(mysql_num_rows($query)==1) { $x=mysql_fetch_array($query); $author = $x['author']; $title = $x['title']; if($author!=$username) { mysql_query("DELETE FROM `poem` WHERE `id` = '$did' AND `author` = '$username'") or die(mysql_error()); echo "You have deleted the poem: $title"; } else { echo 'You are not the author of this poem'; } } } ?>