Create("churchil_demo"); if ($NewCat != "") { # If we've got any data handed in via CGI, then add the # new catagory to both the Catagories and CatagoryList # tables. $NewCat2 = AddSlashes($NewCat); if ($SubCat != 0) { $leve = $sql->QueryItem("select Level from Catagories where ID = $SubCat"); $level++; if ($level >= 4) { ErrorMsg("Catagory depth limited to 4"); } } else { $level = 0; } # Adding to the Catagories table $sql->Insert("insert into Catagories values(0,'$NewCat2',$level,$SubCat)"); # Adding to the CatagoryList table if ($SubCat != 0) { # If we've got a higher catagory, get it's name and append # the new catagory name onto the end of it. $name = $sql->QueryItem("select Name from CatagoryList where ID = $SubCat"); $name = AddSlashes($name).":".$NewCat2; } else { $name = $NewCat2; } # Snag the ID value of the new catagory that was created as # a result of the insert into the Catagory table. $query = "select ID from Catagories where Name = '$NewCat2'"; $id = $sql->QueryItem($query); # Insert into the CatagoryList table $sql->Insert("insert into CatagoryList values($id,'$name',0)"); # Print out a confirmation message so the users know it worked echo("

Added Catagory: $name

\n"); } ?>

Add a New Catagory
Catagory:
This new catagory will be a subcatagory of: