Report#72: Full MSSQL support - added DB switches to these blocks, with the MSSQL fixes provided by Mesmeric in this thread: http://www.board3.de/viewtopic.php?f=10&t=275
Also added a Postgres switch to the random_member.php to avoid bugs with this DB type ( ORDER BY RANDOM() ). Have to be tested by a MSSQL user.
This commit is contained in:
@@ -20,13 +20,35 @@ if (!defined('IN_PORTAL'))
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_type <> ' . USER_IGNORE . '
|
||||
AND user_type <> ' . USER_INACTIVE . '
|
||||
ORDER BY RAND()
|
||||
LIMIT 1';
|
||||
$result = $db->sql_query($sql);
|
||||
switch ($db->sql_layer)
|
||||
{
|
||||
case 'postgres':
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_type <> ' . USER_IGNORE . '
|
||||
AND user_type <> ' . USER_INACTIVE . '
|
||||
ORDER BY RANDOM()';
|
||||
break;
|
||||
|
||||
case 'mssql':
|
||||
case 'mssql_odbc':
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_type <> ' . USER_IGNORE . '
|
||||
AND user_type <> ' . USER_INACTIVE . '
|
||||
ORDER BY NEWID()';
|
||||
break;
|
||||
|
||||
default:
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_type <> ' . USER_IGNORE . '
|
||||
AND user_type <> ' . USER_INACTIVE . '
|
||||
ORDER BY RAND()';
|
||||
break;
|
||||
}
|
||||
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
|
||||
$avatar_img = get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']);
|
||||
|
||||
Reference in New Issue
Block a user