if (SQL_NUMROWS($result) == 1) {
// Init variables
$min_users = '0'; $min_prices = '0';
+
// Load data
if (getExtensionVersion('rallye') >= '0.2.0') {
list($id, $title, $start, $end, $notify, $min_users, $min_prices) = SQL_FETCHROW($result);
// Free result
SQL_FREERESULT($result);
- // Check if line is already included...
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s AND `userid`=%s LIMIT 1",
- array(bigintval($id), bigintval($userid)), __FUNCTION__, __LINE__);
-
- // Is this user added?
- if (SQL_NUMROWS($result) == '0') {
- // Add userid and his ref count to table
- SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_rallye_users` (`rallye_id`, `userid`, `refs`)
-VALUES ('%s','%s',0)",
- array(bigintval($id), bigintval($userid)), __FUNCTION__, __LINE__);
- } // END - if
-
- // Free memory
- SQL_FREERESULT($result);
-
if ($notify == 'Y') {
// Transfer all neccessary data to the global $content array
$content['start'] = generateDateTime($start, 2);
$message = loadEmailTemplate('member_rallye_notify', $content, $userid);
sendEmail($userid, sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $message);
} // END - if
+
+ // Check if line is already included...
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s AND `userid`=%s LIMIT 1",
+ array(
+ bigintval($id),
+ bigintval($userid)
+ ), __FUNCTION__, __LINE__);
+
+ // Is this user added?
+ if (SQL_NUMROWS($result) < 1) {
+ // Add userid and his ref count to table
+ SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_rallye_users` (`rallye_id`, `userid`, `refs`)
+VALUES ('%s','%s',0)",
+ array(
+ bigintval($id),
+ bigintval($userid)
+ ), __FUNCTION__, __LINE__);
+ } // END - if
+
+ // Free memory
+ SQL_FREERESULT($result);
} // END - if
}