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,167
    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,167
    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,167
    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,167
    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,167
    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: 11
    Last Post: 25 Aug 2006, 03:23 PM
  2. Fatal error required language file is missing
    By baba in forum Addon Language Packs
    Replies: 2
    Last Post: 12 Aug 2006, 10:13 AM
  3. fatal error when adding product
    By gnat in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 26 Jul 2006, 09:42 PM
  4. Fatal errors after clean (successful) install
    By dustygain in forum Installing on a Linux/Unix Server
    Replies: 2
    Last Post: 26 May 2006, 04:31 AM

Bookmarks

Posting Permissions

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