X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fmember%2Fwhat-categories.php;h=13075a351e7460a95849f4b0e5960920c7176cfa;hp=2812f0b0707d822f8e36fbb04497b88004290710;hb=d712e3a5c13266fc0017f6724e7cb372442c7cc3;hpb=d34902c93ffcf249bde85f19aeaa6159c54ec6cc diff --git a/inc/modules/member/what-categories.php b/inc/modules/member/what-categories.php index 2812f0b070..13075a351e 100644 --- a/inc/modules/member/what-categories.php +++ b/inc/modules/member/what-categories.php @@ -82,8 +82,11 @@ if (!SQL_HASZERONUMS($result)) { $result_user = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_cats` WHERE `userid`=%s AND `cat_id`=%s LIMIT 1", array(getMemberId(), bigintval($cat)), __FILE__, __LINE__); - if (!SQL_HASZERONUMS($result_user)) { - $sql = "INSERT INTO `{?_MYSQL_PREFIX?}_user_cats` (userid, cat_id) VALUES ('%s','%s')"; + // Debug message + //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'cat='.$cat.',joined='.$joined.',getMemberId()='.getMemberId().',SQL_HASZERONUMS()='.intval(SQL_HASZERONUMS($result_user))); + + if (SQL_HASZERONUMS($result_user)) { + $sql = "INSERT INTO `{?_MYSQL_PREFIX?}_user_cats` (`userid`, `cat_id`) VALUES (%s,%s)"; } // END - if // Free memory @@ -133,7 +136,7 @@ if (!SQL_HASZERONUMS($result)) { $content['jy'] = ''; // When we found an entry don't read it, just change the jx elements - if (isPostRequestParameterSet('cat')) { + if ((isFormSent()) && (isPostRequestParameterSet('cat'))) { // Form sent? if (postRequestParameter('cat', $content['id']) =='Y') { $content['jy'] = ' checked="checked"'; @@ -144,7 +147,7 @@ if (!SQL_HASZERONUMS($result)) { if (countSumTotalData(getMemberId(), 'user_cats', 'id', 'userid', true, sprintf(" AND `cat_id`=%s", bigintval($content['id']))) == 1) { $content['jn'] = ''; $content['jy'] = ' checked="checked"'; - } + } // END - if } // Load row template and switch colors