Visa ett inlägg
Oläst 2011-04-28, 12:54 #1
edgren edgren är inte uppkopplad
Nykomling
 
Reg.datum: Sep 2010
Inlägg: 21
edgren edgren är inte uppkopplad
Nykomling
 
Reg.datum: Sep 2010
Inlägg: 21
Standard ArrowChat-problem; hittar inte ens vänner

Hej!
Jag har precis skaffat ArrowChat och håller på att konfigurera denna underbara funktion. Allt funkar galant, men ArrowChat hittar inte mina vänner. Då min största svaghet är LEFT JOIN när det gäller SQL-frågor, så tänkte jag be er om hjälp med detta.

De databaser som involverar mitt problem, är följande:
Kod:
CREATE TABLE IF NOT EXISTS `arrowchat_status` (
  `userid` varchar(100) NOT NULL,
  `message` text,
  `status` varchar(10) DEFAULT NULL,
  `theme` int(3) unsigned DEFAULT NULL,
  `popout` int(11) unsigned DEFAULT NULL,
  `typing` text,
  `hide_bar` tinyint(1) unsigned DEFAULT NULL,
  `play_sound` tinyint(1) unsigned DEFAULT '1',
  `window_open` tinyint(1) unsigned DEFAULT NULL,
  `only_names` tinyint(1) unsigned DEFAULT NULL,
  `chatroom_window` varchar(2) NOT NULL DEFAULT '-1',
  `chatroom_stay` varchar(2) NOT NULL DEFAULT '-1',
  `chatroom_block_chats` tinyint(1) unsigned DEFAULT NULL,
  `announcement` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `unfocus_chat` text,
  `focus_chat` varchar(20) DEFAULT NULL,
  `last_message` text,
  `apps_bookmarks` text,
  `apps_other` text,
  `session_time` int(20) unsigned NOT NULL,
  `is_admin` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `hash_id` varchar(20) NOT NULL,
  PRIMARY KEY (`userid`),
  KEY `hash_id` (`hash_id`),
  KEY `session_time` (`session_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



CREATE TABLE IF NOT EXISTS `friends` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `id_requester` int(10) DEFAULT '0',
  `id_answer` int(10) DEFAULT '0',
  `id_category` int(10) DEFAULT '0',
  `post_description` text NOT NULL,
  `post_reason` text NOT NULL,
  `date_added` datetime NOT NULL,
  `date_edited` datetime NOT NULL,
  `info_ipaddress` text NOT NULL,
  `is_accepted` enum('0','1') DEFAULT '0',
  `is_realfriend` enum('0','1') DEFAULT '0',
  `is_favorite` enum('0','1') DEFAULT '0',
  `is_vip` enum('0','1') DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;




CREATE TABLE IF NOT EXISTS `members` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `member_user` varchar(20) NOT NULL,
  `member_pass` text NOT NULL,
  `member_email` text NOT NULL,
  `member_phone` varchar(11) NOT NULL,
  `info_ipaddress` text NOT NULL,
  `info_name` text NOT NULL,
  `info_birthdate` date NOT NULL,
  `info_website` text NOT NULL,
  `info_living_county` varchar(50) NOT NULL,
  `info_living_city` varchar(50) NOT NULL,
  `info_sex` enum('P','F') NOT NULL,
  `info_sexstatus` int(11) DEFAULT NULL,
  `info_civilstatus` int(11) DEFAULT NULL,
  `info_civilstatus_with` int(11) DEFAULT NULL,
  `info_sexposition` int(11) DEFAULT NULL,
  `info_searchingfor` int(11) DEFAULT NULL,
  `info_favsexposition` int(11) DEFAULT NULL,
  `is_confirmed` enum('0','1') DEFAULT '0',
  `is_admin` enum('0','1') DEFAULT '0',
  `is_online` enum('0','1') DEFAULT '0',
  `date_registred` datetime NOT NULL,
  `date_loggedin` datetime NOT NULL,
  `date_lastactive` datetime NOT NULL,
  `date_payed` datetime NOT NULL,
  `date_avataruploaded` datetime NOT NULL,
  `date_lastchange` datetime NOT NULL,
  `payed` enum('0','1') DEFAULT '0',
  `payed_sum` bigint(20) NOT NULL,
  `payed_package` enum('0','1','2') DEFAULT '0',
  `avatar_status` enum('0','1') DEFAULT '0',
  `has_changednick` enum('0','1') DEFAULT '0',
  `registredvia_database` enum('0','1') DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=43 ;

Såhär ser en del av min config.php-fil ut för ArrowChat:
PHP-kod:
define('TABLE_PREFIX',''); 
define('DB_USERTABLE','members'); 
define('DB_USERTABLE_NAME','member_user'); 
define('DB_USERTABLE_USERID','id'); 
define('DB_USERTABLE_AVATAR',''); 
define('DB_FRIENDSTABLE','friends'); 
define('DB_FRIENDSTABLE_USERID''id_answer'); 
define('DB_FRIENDSTABLE_FRIENDID''id_requester'); 
define('DB_FRIENDSTABLE_FRIENDS''is_accepted'); 

Såhär ser funktionen som jag har problem med, ut:
PHP-kod:
function getFriendsList($userid,$time) {
    global 
$online_timeout;
    
    
$sql = ("SELECT DISTINCT ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." userid, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_NAME." username, arrowchat_status.session_time lastactivity, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_AVATAR." avatar, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." link, arrowchat_status.message, arrowchat_status.status
        FROM "
.TABLE_PREFIX.DB_FRIENDSTABLE.
        JOIN "
.TABLE_PREFIX.DB_USERTABLE.
            ON  "
.TABLE_PREFIX.DB_FRIENDSTABLE.".".DB_FRIENDSTABLE_FRIENDID." = ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID.
        LEFT JOIN arrowchat_status 
            ON "
.TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." = arrowchat_status.userid 
        WHERE "
.TABLE_PREFIX.DB_FRIENDSTABLE.".".DB_FRIENDSTABLE_USERID." = '".mysql_real_escape_string($userid)."' 
            AND "
.TABLE_PREFIX.DB_FRIENDSTABLE.".".DB_FRIENDSTABLE_FRIENDS." = 1 
            AND (arrowchat_status.session_time + 60 + "
.$online_timeout.") > ".time().
        ORDER BY "
.TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_NAME." ASC");
    
    return 
$sql



Kan någon vänlig själ här, hjälpa mig med mitt problem?
Tack så mycket på förhand!
edgren är inte uppkopplad   Svara med citatSvara med citat