Jump to content

viewing names of deleted mysql rows


M.O.S. Studios

Recommended Posts

Hey,

  I'm writting a script that deletes multiple rows from a mysql db.

this is how I'm doing it at the moment

$db_headers=mysql_query("SELECT * FROM `headers` WHERE `header` = '".$_POST['head_index']."'");
while(list($index, $name, $internal, $inlink, $exlink, $header, $sort, $act)=mysql_fetch_array($db_headers))
{
	$query="DELETE FROM `headers` WHERE `headers` = ".index." LIMIT 1";
                          mysql_query($query);
                          $resaults .=$name." hass been deleted.";
}

 

i know i could do this

 

mysql_query("DELETE FROM `headers` WHERE `header` = '".$_POST['head_index']."'");

 

how ever how would i get the Fields it deleted?

Link to comment
https://forums.phpfreaks.com/topic/156942-viewing-names-of-deleted-mysql-rows/
Share on other sites

In most real life applications data is not actually deleted. It if was worth the time to insert it into a table it is valuable enough to keep for some future purpose (restore, reporting, tracking...) It is just marked as being deleted or it is moved to a deleted item table.

i thought i would reword my last statment:

 

well in the top example I do select all the values before deleting them, so i can have a list of what was deleted.

however I was wondering if there was a function that would select and mark down a value before deleting it.

That way i dont have to do 2 db querys.

 

And i do need to delete them, there is no reason i would need to resotre them.

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.