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 } } ?> Link to comment https://forums.phpfreaks.com/topic/81115-cannot-update-my-database-using-a-form/ 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'"); Link to comment https://forums.phpfreaks.com/topic/81115-cannot-update-my-database-using-a-form/#findComment-411599 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>'; } } ?> Link to comment https://forums.phpfreaks.com/topic/81115-cannot-update-my-database-using-a-form/#findComment-411603 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.