if (isset($_GET['delete'])) { if ($_SESSION[mid] == $id) { $_GET['delete'] = $deleteid; mysql_query("DELETE FROM portfoliocomments WHERE pcomment='{$_GET['delete']}'"); $_SESSION[justdelportfoliocomment] = true; header( 'Location: ./index.php?member=' . $id . '&page=last'); } else { header( 'Location: ./index.php?member=' . $id . '&page=last'); } } Code (markup): Which when the browser is set at index.php?member=1&delete=11 it will delete row 11. But it does not delete anything, and it does not give an error.
Hi, You need to manage the errors yourself, try this: if (isset($_GET['delete'])) { if ($_SESSION['mid'] == $id) { $_GET['delete'] = $deleteid; $boolQry = mysql_query("DELETE FROM portfoliocomments WHERE pcomment='{$_GET['delete']}'"); if($boolQry) { $_SESSION[justdelportfoliocomment] = true; header( 'Location: ./index.php?member=' . $id . '&page=last'); } else { die('Invalid query: ' . mysql_error()); } } else { header( 'Location: ./index.php?member=' . $id . '&page=last'); } } PHP: It will check to make sure you do not have a MySQL error before re-directing to the next page. Also, is this the full code - You refer to $_GET['delete'] = $deleteid; but there is no $deleteid being set in this code. It isn't good practice to use $_GET[] variables in MySQL queries, users can 'inject' SQL commands into your database as they please, have a look at using mysql_real_escape_string() and checking the data type before inserting it into the database. Regards, Steve