Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1
    Join Date
    Apr 2006
    Location
    Lansing, MI
    Posts
    147
    Plugin Contributions
    0

    Fatal Error with the Counter.php

    Fatal error: Call to a member function Execute() on a non-object in /home/.ambale/whiskeyb/dicksgeneral.com/includes/counter.php on line 23

    Code:
    $date_now = date('Ymd');
    $counter_query = "select startdate, counter, session_counter from " . TABLE_COUNTER_HISTORY . " where startdate='" . $date_now . "'";
    LINE 23 ----> $counter = $db->Execute($counter_query); <---- LINE 23
    if ($counter->RecordCount() <= 0) {
      $date_now = date('Ymd');
      $sql = "insert into " . TABLE_COUNTER_HISTORY . " (startdate, counter, session_counter) values ('" . $date_now . "', '1', '1')";
      $db->Execute($sql);
      $counter_startdate = $date_now;
      $counter_now = 1;
    } else {
      $counter_startdate = $counter->fields['startdate'];
      $counter_now = ($counter->fields['counter'] + 1);
      $session_counter_now = ($counter->fields['session_counter'] + $session_counter);
      $sql = "update " . TABLE_COUNTER_HISTORY . " set counter = '" . $counter_now . "', session_counter ='" . $session_counter_now . "' where startdate='" . $date_now . "'";
      $db->Execute($sql);
    }
    How do I fix this error?

    Much Thanks!

  2. #2
    Join Date
    Feb 2006
    Location
    Chicago
    Posts
    1,162
    Plugin Contributions
    0

    Default Re: Fatal Error with the Counter.php

    Which version of PHP?
    Tutorials on Zen Cart
    http://tutorials.zen-cart.com/index.php
    ---------------
    advanced.programmer at gmail dot com
    In love with Zen Cart!!

  3. #3
    Join Date
    Apr 2006
    Location
    Lansing, MI
    Posts
    147
    Plugin Contributions
    0

    Default Re: Fatal Error with the Counter.php

    PHP v5.1.2

  4. #4
    Join Date
    Feb 2006
    Location
    Chicago
    Posts
    1,162
    Plugin Contributions
    0

    Default Re: Fatal Error with the Counter.php

    Ok
    Does this error occurs only for counter?
    Are all other pages working fine?
    San
    Tutorials on Zen Cart
    http://tutorials.zen-cart.com/index.php
    ---------------
    advanced.programmer at gmail dot com
    In love with Zen Cart!!

  5. #5
    Join Date
    Apr 2006
    Location
    Lansing, MI
    Posts
    147
    Plugin Contributions
    0

    Default Re: Fatal Error with the Counter.php

    As far as I know, everything else works fine.

    I just applied the new security update (which doens't touch the coutner.php file) and when I went to load the page to see if there way anything I need to fix and I got hit with the error.

  6. #6
    Join Date
    Feb 2006
    Location
    Chicago
    Posts
    1,162
    Plugin Contributions
    0

    Default Re: Fatal Error with the Counter.php

    can you post the complete counter.php file here?
    Tutorials on Zen Cart
    http://tutorials.zen-cart.com/index.php
    ---------------
    advanced.programmer at gmail dot com
    In love with Zen Cart!!

  7. #7
    Join Date
    Apr 2006
    Location
    Lansing, MI
    Posts
    147
    Plugin Contributions
    0

    Default Re: Fatal Error with the Counter.php

    Code:
    <?php
    /**
     * counter.php
     *
     * @package general
     * @copyright Copyright 2003-2006 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: counter.php 3194 2006-03-15 23:17:53Z wilt $
     * @private
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die('Illegal Access');
    }
    if (isset($_SESSION['session_counter']) && $_SESSION['session_counter'] == true) {
      $session_counter = 0;
    } else {
      $session_counter = 1;
      $_SESSION['session_counter'] = true;
    }
    $date_now = date('Ymd');
    $counter_query = "select startdate, counter, session_counter from " . TABLE_COUNTER_HISTORY . " where startdate='" . $date_now . "'";
    $counter = $db->Execute($counter_query);
    if ($counter->RecordCount() <= 0) {
      $date_now = date('Ymd');
      $sql = "insert into " . TABLE_COUNTER_HISTORY . " (startdate, counter, session_counter) values ('" . $date_now . "', '1', '1')";
      $db->Execute($sql);
      $counter_startdate = $date_now;
      $counter_now = 1;
    } else {
      $counter_startdate = $counter->fields['startdate'];
      $counter_now = ($counter->fields['counter'] + 1);
      $session_counter_now = ($counter->fields['session_counter'] + $session_counter);
      $sql = "update " . TABLE_COUNTER_HISTORY . " set counter = '" . $counter_now . "', session_counter ='" . $session_counter_now . "' where startdate='" . $date_now . "'";
      $db->Execute($sql);
    }
    
    $counter_query = "select startdate, counter from " . TABLE_COUNTER;
    $counter = $db->Execute($counter_query);
    if ($counter->RecordCount() <= 0) {
      $date_now = date('Ymd');
      $sql = "insert into " . TABLE_COUNTER . " (startdate, counter) values ('" . $date_now . "', '1')";
      $db->Execute($sql);
      $counter_startdate = $date_now;
      $counter_now = 1;
    } else {
      $counter_startdate = $counter->fields['startdate'];
      $counter_now = ($counter->fields['counter'] + 1);
      $sql = "update " . TABLE_COUNTER . " set counter = '" . $counter_now . "'";
      $db->Execute($sql);
    }
    
    $counter_startdate_formatted = strftime(DATE_FORMAT_LONG, mktime(0, 0, 0, substr($counter_startdate, 4, 2), substr($counter_startdate, -2), substr($counter_startdate, 0, 4)));
    ?>

  8. #8
    Join Date
    Feb 2006
    Location
    Chicago
    Posts
    1,162
    Plugin Contributions
    0

    Default Re: Fatal Error with the Counter.php

    File looks fine
    Somehow $db is not getting initialised!
    Tutorials on Zen Cart
    http://tutorials.zen-cart.com/index.php
    ---------------
    advanced.programmer at gmail dot com
    In love with Zen Cart!!

  9. #9
    Join Date
    Apr 2006
    Location
    Lansing, MI
    Posts
    147
    Plugin Contributions
    0

    Default Re: Fatal Error with the Counter.php

    Lovely.

    I've dropped a line to my hosting company. I'll post an update if they reply.

  10. #10
    Join Date
    Feb 2006
    Location
    Chicago
    Posts
    1,162
    Plugin Contributions
    0

    Default Re: Fatal Error with the Counter.php

    Quote Originally Posted by Tig
    Lovely.

    I've dropped a line to my hosting company. I'll post an update if they reply.
    It seems that some problem happened while doing the upgrade
    Who did the upgrade?
    Can you show me the steps?
    Tutorials on Zen Cart
    http://tutorials.zen-cart.com/index.php
    ---------------
    advanced.programmer at gmail dot com
    In love with Zen Cart!!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 33
    Last Post: 29 Dec 2014, 07:34 PM
  2. v150 install error wont pass the database: PHP Fatal error: 1101:BLOB/TEXT
    By tparmley2001 in forum Installing on a Windows Server
    Replies: 9
    Last Post: 6 Aug 2012, 04:22 AM
  3. Fatal error: includes/counter.php on line 23
    By Kimberl in forum Installing on a Linux/Unix Server
    Replies: 10
    Last Post: 13 Jul 2007, 10:12 PM
  4. Fatal error with sessions.php
    By Elemi in forum General Questions
    Replies: 4
    Last Post: 7 Jan 2007, 06:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg