Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need some urgent help!!


markchiu

Recommended Posts

I believe this is a common error...but so far i have no clue of where to go to check where I did wrong, because i did search, but no answer to match the following one, and I just got the idea of somewhere is re-declare the tep_db_query_t() ...but I don't know where.....

 

Fatal error: Cannot redeclare tep_db_query_t() (previously declared in /home/yadyshop/public_html/includes/functions/database.php:103) in /home/yadyshop/public_html/includes/functions/database.php on line 103

 

recently i have installed the following contris..these are

 

PWA

CCGV

Random Order Number

 

So far, the one had anything to do with database one would be Random Order Number, here is a partial code of Random Order number contri

 

CHANGES TO .../catalog/includes/functions/database.php

------------------------------------------------------

 

Technical notes :

- This is a hacked-up version of the existing functions. It could probably

  be made more compact, but it works.

- I created some new functions rather than patch the existing functions to

  minimise risk of breaking something

 

1) Add the following (it doesn't matter where - I added it just after the existing

function tep_db_perform) :

 

  // Execute the specified SQL on the database. Always exit gracefully,

  // returning any error to the caller

  //

  // Parameters :

  // Your guess is as good as mine - they aren't documented !

  //

  // Returns

  // Resource handle or false on failure

  //

  function tep_db_query_t($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);

 

    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;

  }

 

  // Perform a database 'insert' operation. If a duplicate entry is found then

  // the operation will fail but it will not halt the script. Instead it will

  // exit gracefully back to the caller

  //

  // Paramaters :

  // Your guess is as good as mine - they aren't documented !

  //

  // Returns :

  // false = success. true = failed (insert failed because of duplicate entry)

  // Any failure other than duplicate entry will cause the script to halt so this

  // function will not return

  //

  function tep_db_insert_t($table, $data, $parameters = '', $link = 'db_link')

  {

    // Return status

    $failed = false;

 

    reset($data);

 

    $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) . ')';

 

    // Perform database operation

    $handle = tep_db_query_t($query, $link);

 

    if ($handle === false)

    {

      // status 1062 = duplicate entry attempted

      if (mysql_errno() != 1062)

      {

        // Not expecting this error code - stop the script

        tep_db_error($query, mysql_errno(), mysql_error());

      }

 

      $failed = true;

    }

 

    return $failed;

  }

 

...but then again what I should delete or fix or is another place going wrong??? :unsure: :( PLEASE HELPP!!!!

OS-commerce is great, but with other magical contributions, that is just so "COOL"!

Link to comment
Share on other sites

you have a duplicate function, search for function tep_db_query_t and see where it is defined at, and comment one of them out.

Link to comment
Share on other sites

hey,mibble thanks for the help...I don't know why it works, but then i just delete the part of code which i posted here.....then wha la...the shop works again ;) :D .....i know ye...wow...sort of like you said del the part where i see that problem code...

OS-commerce is great, but with other magical contributions, that is just so "COOL"!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...