MySQL Query Error

Posted by Nano HE on Stack Overflow See other posts from Stack Overflow or by Nano HE
Published on 2010-04-15T23:15:30Z Indexed on 2010/04/15 23:23 UTC
Read the original article Hit count: 335

Filed under:
|
|

I am debug my php forum. Before the error,I modified the DB table name from cdb_sessions to imc_forum_sessions successfully.

I tried my best to debug with NetBeans but can't find the reason.

Could you please have a look at my post below. Thank you.

// It will run to else during debug

if($sid) {
    if($discuz_uid) {
        $query = $db->query("SELECT s.sid, s.styleid, s.groupid='6' AS ipbanned, s.pageviews AS spageviews, s.lastolupdate, s.seccode, $membertablefields
            FROM {$tablepre}sessions s, {$tablepre}members m
            WHERE m.uid=s.uid AND s.sid='$sid' AND CONCAT_WS('.',s.ip1,s.ip2,s.ip3,s.ip4)='$onlineip' AND m.uid='$discuz_uid'
            AND m.password='$discuz_pw' AND m.secques='$discuz_secques'");
    } else { 
        $query = $db->query("SELECT sid, uid AS sessionuid, groupid, groupid='6' AS ipbanned, pageviews AS spageviews, styleid, lastolupdate, seccode
            FROM {$tablepre}sessions WHERE sid='$sid' AND CONCAT_WS('.',ip1,ip2,ip3,ip4)='$onlineip'");
    }
}

MySQL data table exported as below

CREATE TABLE IF NOT EXISTS `imc_forum_sessions` (
  `sid` char(6) NOT NULL DEFAULT '',
  `ip1` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `ip2` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `ip3` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `ip4` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `uid` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `username` char(15) NOT NULL DEFAULT '',
  `groupid` smallint(6) unsigned NOT NULL DEFAULT '0',
  `styleid` smallint(6) unsigned NOT NULL DEFAULT '0',
  `invisible` tinyint(1) NOT NULL DEFAULT '0',
  `action` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `lastactivity` int(10) unsigned NOT NULL DEFAULT '0',
  `lastolupdate` int(10) unsigned NOT NULL DEFAULT '0',
  `pageviews` smallint(6) unsigned NOT NULL DEFAULT '0',
  `seccode` mediumint(6) unsigned NOT NULL DEFAULT '0',
  `fid` smallint(6) unsigned NOT NULL DEFAULT '0',
  `tid` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `bloguid` mediumint(8) unsigned NOT NULL DEFAULT '0',
  UNIQUE KEY `sid` (`sid`),
  KEY `uid` (`uid`),
  KEY `bloguid` (`bloguid`)
) ENGINE=MEMORY DEFAULT CHARSET=utf8 MAX_ROWS=5000;

--
-- Dumping data for table `imc_forum_sessions`
--

    INSERT INTO `imc_forum_sessions` (`sid`, `ip1`, `ip2`, `ip3`, `ip4`, `uid`, `username`, `groupid`, `styleid`, `invisible`, `action`, `lastactivity`, `lastolupdate`, `pageviews`, `seccode`, `fid`, `tid`, `bloguid`) VALUES
    ('NYC4r7', 127, 0, 0, 1, 0, '', 6, 5, 0, 3, 1271372018, 0, 0, 939015, 51, 303, 0);

And the IE error showed,

Time: 2010-4-16 7:12am
Script: /forum/index.php

SQL: SELECT sid, uid AS sessionuid, groupid, groupid='6' AS ipbanned, pageviews AS spageviews, styleid, lastolupdate, seccode
FROM [Table]sessions WHERE sid='NYC4r7' AND CONCAT_WS('.',ip1,ip2,ip3,ip4)='127.0.0.1'
Error: Table 'dbbbs.[Table]sessions' doesn't exist
Errno.: 1146

Similar error report has beed dispatched to administrator before.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about php