if (isFormSent('add')) {
// Add a new category
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_cats` WHERE `cat`='%s' LIMIT 1",
+ $result = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_cats` WHERE `cat`='%s' LIMIT 1",
array(postRequestElement('catname')), __FILE__, __LINE__);
- if (SQL_HASZERONUMS($result)) {
+ if (ifSqlHasZeroNums($result)) {
// Category does not exists, we simply add it...
- SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_cats` (`cat`, `visible`, `sort`) VALUES ('%s','%s','%s')",
+ sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_cats` (`cat`, `visible`, `sort`) VALUES ('%s','%s','%s')",
array(
postRequestElement('catname'),
postRequestElement('visible'),
}
// Free memory
- SQL_FREERESULT($result);
+ sqlFreeResult($result);
// Display message
displayMessage($content);
if (!empty($cat)) {
switch (getRequestElement('do')) {
case 'edit': // Change categories
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_cats` SET `cat`='%s',`visible`='%s',`sort`=%s WHERE `id`=%s LIMIT 1",
+ sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_cats` SET `cat`='%s',`visible`='%s',`sort`=%s WHERE `id`=%s LIMIT 1",
array(
$cat,
postRequestElement('visible', $id),
break;
case 'delete': // Delete categories
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_cats` WHERE `id`=%s LIMIT 1",
+ sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_cats` WHERE `id`=%s LIMIT 1",
array($id), __FILE__, __LINE__);
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_cats` WHERE `cat_id`=%s",
+ sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_cats` WHERE `cat_id`=%s",
array($id), __FILE__, __LINE__);
$TEXT = '{--ADMIN_CATEGORIES_DELETED--}';
break;
$OUT = '';
foreach (postRequestElement('sel') as $id => $value) {
// Load data from the category
- $result = SQL_QUERY_ESC("SELECT `id`, `visible`, `sort` FROM `{?_MYSQL_PREFIX?}_cats` WHERE `id`=%s LIMIT 1",
+ $result = sqlQueryEscaped("SELECT `id`, `visible`, `sort` FROM `{?_MYSQL_PREFIX?}_cats` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
- $content = SQL_FETCHARRAY($result);
+ $content = sqlFetchArray($result);
// Free result
- SQL_FREERESULT($result);
+ sqlFreeResult($result);
// Prepare data for the row template
$content['visible_selection'] = addSelectionBox('yn', $content['visible'], 'visible', $content['id']);
$CATS = '';
// Load all categories
- $result = SQL_QUERY("SELECT `id`, `cat`, `visible`, `sort` FROM `{?_MYSQL_PREFIX?}_cats` ORDER BY `sort` ASC", __FILE__, __LINE__);
- if (!SQL_HASZERONUMS($result)) {
+ $result = sqlQuery("SELECT `id`, `cat`, `visible`, `sort` FROM `{?_MYSQL_PREFIX?}_cats` ORDER BY `sort` ASC", __FILE__, __LINE__);
+ if (!ifSqlHasZeroNums($result)) {
// Init variables
$OUT = '';
// List already existing categories for editing
- while ($content = SQL_FETCHARRAY($result)) {
+ while ($content = sqlFetchArray($result)) {
// Put cat descriptions into variable for the selection box
if (strlen($content['cat']) > 40) $content['cat'] = substr($content['cat'], 0, 37) . '...';
$CATS .= '<option value="' . $content['sort'] . '">' . $content['cat'] . '</option>';
} // END - while
// Free memory
- SQL_FREERESULT($result);
+ sqlFreeResult($result);
// Load main template
loadTemplate('admin_list_cats', FALSE, $OUT);