osCmax v2.5 User Manual
Results 1 to 7 of 7

Please help... going nuts

This is a discussion on Please help... going nuts within the osCmax v1.7 Discussion forums, part of the osCmax v1.7 Forums category; Please help I have been going crazy trying to figure this one out for days now. I have read just ...

      
  1. #1
    Active Member
    Join Date
    May 2003
    Posts
    185
    Rep Power
    10


    Default Please help... going nuts

    Please help I have been going crazy trying to figure this one out for days now. I have read just about every post on this and other forum and I can not get it worked out. I have found other peoples posts that are having the same problem but no replys as to how to fix the problem. I can't believe that everyone just give up on this one.

    The problem that I am having is that if you click on any of the main Categories that have sub-categories I get the following error message and not the sub-category pictures;

    Fatal error: Cannot redeclare tep_db_connect() in /home/myusername/public_html/includes/functions/database.php on line 13

    This is my database.php;

    <?php
    /*
    $Id: database.php,v 1.21 2003/06/09 21:21:59 hpdl Exp $

    osCommerce, Open Source E-Commerce Solutions
    http://www.oscommerce.com

    Copyright (c) 2003 osCommerce

    Released under the GNU General Public License
    */

    function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {
    global $$link;

    if (USE_PCONNECT == 'true') {
    $$link = mysql_pconnect($server, $username, $password);
    } else {
    $$link = mysql_connect($server, $username, $password);
    }

    if ($$link) mysql_select_db($database);

    return $$link;
    }

    function tep_db_close($link = 'db_link') {
    global $$link;

    return mysql_close($$link);
    }

    function tep_db_error($query, $errno, $error) {
    die('<font color="#000000"><b>' . $errno . ' - ' . $error . '<br><br>' . $query . '<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>');
    }

    function tep_db_query($query, $link = 'db_link') {
    global $$link;

    if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
    error_log('QUERY ' . $query . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
    }

    $result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());

    if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
    $result_error = mysql_error();
    error_log('RESULT ' . $result . ' ' . $result_error . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
    }

    return $result;
    }

    function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') {
    reset($data);
    if ($action == 'insert') {
    $query = 'insert into ' . $table . ' (';
    while (list($columns, ) = each($data)) {
    $query .= $columns . ', ';
    }
    $query = substr($query, 0, -2) . ') values (';
    reset($data);
    while (list(, $value) = each($data)) {
    switch ((string)$value) {
    case 'now()':
    $query .= 'now(), ';
    break;
    case 'null':
    $query .= 'null, ';
    break;
    default:
    $query .= '\'' . tep_db_input($value) . '\', ';
    break;
    }
    }
    $query = substr($query, 0, -2) . ')';
    } elseif ($action == 'update') {
    $query = 'update ' . $table . ' set ';
    while (list($columns, $value) = each($data)) {
    switch ((string)$value) {
    case 'now()':
    $query .= $columns . ' = now(), ';
    break;
    case 'null':
    $query .= $columns .= ' = null, ';
    break;
    default:
    $query .= $columns . ' = \'' . tep_db_input($value) . '\', ';
    break;
    }
    }
    $query = substr($query, 0, -2) . ' where ' . $parameters;
    }

    return tep_db_query($query, $link);
    }

    function tep_db_fetch_array($db_query) {
    return mysql_fetch_array($db_query, MYSQL_ASSOC);
    }

    function tep_db_num_rows($db_query) {
    return mysql_num_rows($db_query);
    }

    function tep_db_data_seek($db_query, $row_number) {
    return mysql_data_seek($db_query, $row_number);
    }

    function tep_db_insert_id() {
    return mysql_insert_id();
    }

    function tep_db_free_result($db_query) {
    return mysql_free_result($db_query);
    }

    function tep_db_fetch_fields($db_query) {
    return mysql_fetch_field($db_query);
    }

    function tep_db_output($string) {
    return htmlspecialchars($string);
    }

    function tep_db_input($string) {
    return addslashes($string);
    }

    function tep_db_prepare_input($string) {
    if (is_string($string)) {
    return trim(tep_sanitize_string(stripslashes($string)));
    } elseif (is_array($string)) {
    reset($string);
    while (list($key, $value) = each($string)) {
    $string[$key] = tep_db_prepare_input($value);
    }
    return $string;
    } else {
    return $string;
    }
    }
    ?>


    Does anyone know what might be causing this error and how can I fix this so that I will get my sub-category pictures? If you want to see what I'm talking about please visit www.giftsuniqueshop.com and click on any category with subcategory.

    Thank you for any and all help.

  2. #2
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    Default RE: Please help... going nuts

    Check your error logs to see if there is any more information. I will take a look at it tomorrow to see if I can find anything to help... It is late and I have had a long day today.

    Maybe with fresh eyes I can help you out...

    Look for an email tomorrow.
    Michael Sasek
    osCMax Developer


    osCmax Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  3. #3
    Active Member
    Join Date
    May 2003
    Posts
    185
    Rep Power
    10


    Default Re: RE: Please help... going nuts

    Quote Originally Posted by msasek
    Check your error logs to see if there is any more information. I will take a look at it tomorrow to see if I can find anything to help... It is late and I have had a long day today.

    Maybe with fresh eyes I can help you out...

    Look for an email tomorrow.
    Thanks Michael I appreciate the help. I just looked at my error log and didn't see anything new there either just the same error message. This is from the error log;

    [Wed Jun 8 10:15:18 2005] [error] PHP Fatal error: Cannot redeclare tep_db_connect() in /home/giftttny/public_html/includes/functions/database.php on line 13
    [Wed Jun 8 10:15:06 2005] [error] PHP Fatal error: Cannot redeclare tep_db_connect() in /home/giftttny/public_html/includes/functions/database.php on line 13

    I'm also still looking at it. I'll let you know if I find anything. Please let me know if you find anything.

    Jose

  4. #4
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    Default RE: Re: RE: Please help... going nuts

    Jose,

    I fixed it for you.

    You had replaced the original template index.nested.tpl.php with a non-BTS compliant file, in fact it was a copy of an old default.php file from a really old version of osCommerce. I renamed it, and replaced the original osCMax v1.7 version of index.nested.tpl.php and everything is working again.
    Michael Sasek
    osCMax Developer


    osCmax Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  5. #5
    Active Member
    Join Date
    May 2003
    Posts
    185
    Rep Power
    10


    Default Re: RE: Re: RE: Please help... going nuts

    Quote Originally Posted by msasek
    Jose,

    I fixed it for you.

    You had replaced the original template index.nested.tpl.php with a non-BTS compliant file, in fact it was a copy of an old default.php file from a really old version of osCommerce. I renamed it, and replaced the original osCMax v1.7 version of index.nested.tpl.php and everything is working again.
    Thank You Michael Your The Man you don't know how this has been driving me crazy. Since the error message was saying that the problem was in my database.php file I just kept going over it again and again and....... I don't know how I got the wrong index.nested.tpl.php but I will certainly take a look at it to make sure it hopefully doesn't happen again.
    Thanks alot guy I appreciate it.
    Jose

  6. #6
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    Default RE: Re: RE: Re: RE: Please help... going nuts

    Jose, the original file was renamed to index.nested2.tpl.php and there was the other incorrect file index.nested.tpl.php in its place. So somewhere along the line you switched them (probably testing something) and you most likely forgot about the change. I do it all the time

    An error like that, where it says a function cannot be redelcared is usually not caused by the file where the error shows up. What happened is that your index.nested.tpl.php was calling database.php a second time when it was not supposed to. It was easy to track down when I compared your template files against the standard osCMax templates. Your index.nested.tpl.php was about 5 times larger in size than the correct template, so it stood out clearly.
    Michael Sasek
    osCMax Developer


    osCmax Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  7. #7
    Active Member
    Join Date
    May 2003
    Posts
    185
    Rep Power
    10


    Default

    I have been testing a couple of different MOD's so it is highly possible that I switch it and forgot about it as you suggested. I will take a look at some of the MOD's that I was testing and let you know what I find.
    Again I thank you for pointing this out to me and for all your help.

    Jose

Similar Threads

  1. I'm going nuts with this; lots of questions; I need help!
    By puggybelle in forum osCmax v2 Customization/Mods
    Replies: 4
    Last Post: 10-26-2005, 10:45 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
  •