Jump to content

Recommended Posts

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

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>';
}

}

?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.