Hi
I've got kind of a strange problem with data that disappears from certain tables in the db
this happened on 3 different sites with 3 different admins but all based on a simple admin that i set up - now it's happened 3 times i can see there's a pattern to it but I'm stumped as to what it could be
the tables in question contain category names and ids which are then used in the products table for sorting the products into categories
what's happening is that the products table is fine but the table holding the categories just suddenly gets completely emptied apart from the default category with an id of zero - this would suggest that the emptying is being done by my php code because I've made it so that the user cannot delete the default category - also, in the products table the cat_id gets toggled to 0 so it must be coming from the code
here's the code used to delete categories - it's a click on a symbol in the page that triggers it
if($_GET['action'] == "delete"){
$thisID = $_GET['deleteID'];
$query2="UPDATE prods SET cat_id='0' , prod_online='0' WHERE (cat_id='$thisID')";
mysql_query($query2);
//echo "<br>".$query2;
$query="DELETE FROM cat WHERE cat_id='$thisID' LIMIT 1";
mysql_query($query);
//echo "<br>".$query;
}
the html used to trigger the delete look like this :
<a href="page.php?action=delete&deleteID=11" onclick="return confirm('Etes-vous sûr de vouloir supprimer cette catégorie ?')"><img src="images/trash.gif" title="Supprimer cette catégorie" border="0" /></a>
I really cannot see where there could be a problem with the code - is there something really stupidly obvious I've missed here ?!!
thanks