0
votes

I don't know where to start for this error:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'created' in 'field list': SELECT created FROM {counter} WHERE created<>0 ORDER BY created DESC LIMIT 1; Array ( ) in counter_block_view() (line 143 from /customers/6/8/3/lmtc.be/httpd.www/drupal/sites/all/modules/counter/counter.module).

The error happens on login!

The file counter.module looks like this:

127 // counter_insert_delay  
128   $db_types = db_driver();  
129  switch ($db_types) {  
130    case 'mssql':  
131      $sql = " SELECT TOP 1 created FROM {counter} WHERE created<>0 ORDER BY created DESC";  
132      break;  
133  
134    case 'oracle':  
135      $sql = " SELECT created FROM {counter} WHERE ROWNUM=1 AND created<>0 ORDER BY created DESC";  
136      break;  
137  
138    // mysql, mysqli, pgsql.  
139    default:  
140      $sql = " SELECT created FROM {counter} WHERE created<>0 ORDER BY created DESC LIMIT 1";  
141  }  
142  
143  $counter_lastdate = db_query($sql)->fetchField();  

My database looks like this:

22901 --  
22902 -- Table structure for table `counter`  
22903 --  
22904   
22905 CREATE TABLE IF NOT EXISTS `counter` (  
22906   `counter_id` int(11) NOT NULL AUTO_INCREMENT,  
22907   `counter_ip` varchar(32) NOT NULL DEFAULT '',  
22908   `counter_date` varchar(32) NOT NULL DEFAULT '',  
22909   `counter_page` varchar(255) NOT NULL DEFAULT '0',  
22910   PRIMARY KEY (`counter_id`),  
22911  KEY `counter_date` (`counter_date`),  
22912  KEY `counter_ip` (`counter_ip`)  
22913) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=217 ;  

Conclusion: there is indeed no column 'created' in my mysql database. But the last thing I changed at this site were two articles a few months ago. The last change to the structure is from a long time ago, and the site counter has never been changed since the setup of the site.

What can I do to be able to login again? Shall I delete the counter module?
ps I'm not a drupal developer.
I'll thank you in advance for the help.
Kind Greetings, Frank

1

1 Answers

0
votes

May be you have updated your modules but just forgot to run database updates? Try to go to your_site/update.php page and follow instructions.

And of course you have to log in as administrator before you do that.