3 require('inc.header.php');
5 if (isset($_POST['cat_add']) && strlen($_POST['cat_add']) > 0) {
6 if (!$res = mysql_query("INSERT INTO ".$config['tbl_categories']." VALUES (NULL,'".addslashes($_POST['cat_add'])."')")) {
7 echo "<b>Error:</b> ".mysql_error()." <i>(".basename(__FILE__
).", line ".__LINE__
.")</i>\n<p>\n";
9 if (!mysql_affected_rows()) {
10 echo "Could not add category.\n<p>\n";
12 echo "Category added.\n<p>\n";
18 if (!$res = mysql_query("SELECT * FROM ".$config['tbl_categories']." ORDER BY name")) {
19 echo "<b>Error:</b> ".mysql_error()." <i>(".basename(__FILE__
).", line ".__LINE__
.")</i>\n\n";
21 if (!mysql_num_rows($res)) {
22 echo "No categories!\n";
24 echo "<b>Categories</b>\n";
26 while (list($id,$name) = mysql_fetch_row($res)) {
33 echo "<form action=\"$self\" method=\"post\">\n";
34 echo " Add category <input type=\"text\" name=\"cat_add\">\n";
35 echo " <input type=\"submit\" value=\"Add\">\n";
38 require('inc.footer.php');