Query:
SELECT `p`.*, `f`.`ID`,
if(`DateLastNav` > SUBDATE(NOW( ), INTERVAL 1 MINUTE ), 1, 0) AS `is_online`,
UNIX_TIMESTAMP(p.`DateLastLogin`) AS 'TS_DateLastLogin', UNIX_TIMESTAMP(p.`DateReg`) AS 'TS_DateReg' FROM (
SELECT `ID` AS `ID` FROM `sys_friend_list` WHERE `Profile` = '5' AND `Check` =1
UNION
SELECT `Profile` AS `ID` FROM `sys_friend_list` WHERE `ID` = '5' AND `Check` =1
) AS `f`
INNER JOIN `Profiles` AS `p` ON `p`.`ID` = `f`.`ID`
WHERE 1
ORDER BY p.`DateLastLogin`
Mysql error: Incorrect key file for table '/tmp/#sql_4b2d_0.MYI'; try to repair it
Found error in the file '/home/sortirav/public_html/inc/profiles.inc.php' at line 388.
Called 'db_res' function with erroneous argument #0.