Permalink
Browse files

when deleting items remove tag association

  • Loading branch information...
Spiros Ioannou
Spiros Ioannou committed Apr 30, 2012
1 parent b481bbf commit a192d459f657c66d5f5f743d8e645435fed22eae
Showing with 5 additions and 0 deletions.
  1. +4 −0 php/edititem.php
  2. +1 −0 updates/db/1_2.sql
View
@@ -42,6 +42,10 @@
$sql="DELETE from itemlink where itemid1=".$_GET['delid']." or itemid2=".$_GET['delid'];
$sth=db_exec($dbh,$sql);
+ //nullify TAGS
+ $sql="UPDATE tag2item set itemid=null where itemid=".$_GET['delid'];
+ $sth=db_exec($dbh,$sql);
+
//delete item
$sql="DELETE from items where id=".$_GET['delid'];
$sth=db_exec($dbh,$sql);
View
@@ -1,3 +1,4 @@
begin transaction;
+update tag2item set itemid=null where itemid not in (select id from items);
update settings set dbversion=2;
commit;

0 comments on commit a192d45

Please sign in to comment.