* $Author:: $ *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009 - 2013 by Mailer Developer Team *
+ * Copyright (c) 2009 - 2015 by Mailer Developer Team *
* For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
$CATS = '';
if (isFormSent('add')) {
+ // Default message
+ $content = '<span class="bad">{--CATEGORY_ALREADY_EXISTS--}</span>';
+
// Add a new category
$result = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_cats` WHERE `cat`='%s' LIMIT 1",
array(postRequestElement('catname')), __FILE__, __LINE__);
- if (ifSqlHasZeroNums($result)) {
+
+ if (ifSqlHasZeroNumRows($result)) {
// Category does not exists, we simply add it...
sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_cats` (`cat`, `visible`, `sort`) VALUES ('%s','%s','%s')",
array(
postRequestElement('visible'),
bigintval(postRequestElement('parent') + 1)
), __FILE__, __LINE__);
+
+ // Category has been added
$content = '{--CATEGORY_ADDED--}';
- } else {
- // Category does already exists
- $content = '<span class="bad">{--CATEGORY_ALREADY_EXISTS--}</span>';
- }
+ } // END - if
// Free memory
sqlFreeResult($result);
$CATS = '';
// Load all categories
- $result = sqlQuery("SELECT `id`, `cat`, `visible`, `sort` FROM `{?_MYSQL_PREFIX?}_cats` ORDER BY `sort` ASC", __FILE__, __LINE__);
- if (!ifSqlHasZeroNums($result)) {
+ $result = sqlQuery("SELECT
+ `id`,
+ `cat`,
+ `visible`,
+ `sort`
+FROM
+ `{?_MYSQL_PREFIX?}_cats`
+ORDER BY
+ `sort` ASC", __FILE__, __LINE__);
+
+ if (!ifSqlHasZeroNumRows($result)) {
// Init variables
$OUT = '';