Jump to content

cannot update my database using a form


k0rnonthek0b

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

}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.