k0rnonthek0b Posted December 11, 2007 Share Posted December 11, 2007 Hey everyone, I am trying to make it so i can delete my database information using a form, for some reason it wont retrieve the 'id' and instead of any errors or anything all I get is a blank screen. Here is my delete_activities code: <?php include '_prepend.php'; if (!empty($_GET['id'])) { $del = sqlQuery('DELETE FROM activities WHERE id = '.$_GET['id']); //var_dump($del); if ($del['rowsAffected'] > 0) { //then we know it worked, send them back header('Location: view_activities.php'); } else { echo "There was a problem (file may already be deleted), no delete"; ?> <a href="view_activities.php">go back</a> <?php } } ?> Quote Link to comment Share on other sites More sharing options...
revraz Posted December 11, 2007 Share Posted December 11, 2007 change $del = sqlQuery('DELETE FROM activities WHERE id = '.$_GET['id']); to $id=$_GET['id'] $del = sqlQuery("DELETE FROM activities WHERE id = '$id'"); Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 11, 2007 Share Posted December 11, 2007 is this what you were trying to do: <?php include("prepend.php"); $myID = $_GET['id']; if ($myID != NULL) { $del = mysql_query("DELETE FROM activities WHERE id='$myID'"); $del2 = mysql_query("SELECT * FROM activities WHERE id='$myID'"); $DEL = mysql_num_rows($del2); if ($DEL > 0) { //then we know it worked, send them back header('Location: view_activities.php'); exit; } else { echo "There was a problem (file may already be deleted), no delete"; echo ' - <a href="view_activities.php">go back</a>'; } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.