prioritywindows Posted August 18, 2007 Share Posted August 18, 2007 At the very bottom of my shop page says the following: Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/priority/public_html/catalog/includes/functions/database.php:13) in /home/priority/public_html/catalog/includes/functions/database.php on line 13 The easiest thing would be to go to line 13 and erase it. I am afraid though that I could be erasing something important. Help, ...again. :-" BTW, this is a copy of what's inside my database.php file: <?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 © 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; } } ?> Link to comment Share on other sites More sharing options...
prioritywindows Posted August 18, 2007 Author Share Posted August 18, 2007 It occurs on all pages except the home page. Link to comment Share on other sites More sharing options...
germ Posted August 18, 2007 Share Posted August 18, 2007 What this is telling you is that in your trail of "includes" and "requires" in the PHP code, somehow this is getting "included" or "required" more than once. Thus the error. You'll have to look thru the PHP code and find where this is happening the 2nd time and remove it. Personally, I'd just comment it out like this: // If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
prioritywindows Posted August 18, 2007 Author Share Posted August 18, 2007 It makes removing or // editing out even worse. :huh: Link to comment Share on other sites More sharing options...
germ Posted August 18, 2007 Share Posted August 18, 2007 The only place I have that is in "application_top.php" Like this: // include the database functions require(DIR_WS_FUNCTIONS . 'database.php'); I can't say for certain about your installation. :blush: You don't want to edit it out, just find and remove the 2nd instance of this: // include the database functions require(DIR_WS_FUNCTIONS . 'database.php'); I'd just comment it out like this: // include the database functions // require(DIR_WS_FUNCTIONS . 'database.php'); If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
Gauravs Posted August 18, 2007 Share Posted August 18, 2007 It makes removing or // editing out even worse. :huh: Hello ... the problem is not in database.php but the file where database.php is included... As I suggested in a different post to you your template 6057 hasn't been set properly ... thus.. it doesn't find files, where it is supposed to find them. Work on 1 page at a time, locate includes and see if there are multiple includes for same file. Thx, Best Regards,Gaurav Link to comment Share on other sites More sharing options...
prioritywindows Posted August 18, 2007 Author Share Posted August 18, 2007 Changing it to your third code box gave me this: Fatal error: Call to undefined function: tep_db_connect() in /home/priority/public_html/catalog/includes/application_top.php on line 65 I may need to sleep on this, I've been dwelling on this problem for far too long. Link to comment Share on other sites More sharing options...
prioritywindows Posted August 18, 2007 Author Share Posted August 18, 2007 This is another store, I abandoned 6057, it had too many errors. Link to comment Share on other sites More sharing options...
germ Posted August 18, 2007 Share Posted August 18, 2007 application_top.php is where it's supposed to be "required". Find the other instance(s) of it. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
germ Posted August 18, 2007 Share Posted August 18, 2007 May I suggest this approach. If you can, download or FTP the entire contents of your site into a folder on your PC. Do a Google search for "Agent Ransack". It's a free utility used to search for text strings in files. Download and install it. Have it search your files from your site for: database.php I have that text string in only two files: database.php application_top.php My guess is if you do the same, you'll find at least one more instance of it. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
prioritywindows Posted August 18, 2007 Author Share Posted August 18, 2007 Wow, thanks Jim, that advice worked like a charm. The culprit was hiding in application_bottom.php, which would pretty much explain why the error was at the bottom of the page. I double-slashed it and poof, the error was gone. Guess I'm a lucky gal after all. Thanks again! Link to comment Share on other sites More sharing options...
germ Posted August 18, 2007 Share Posted August 18, 2007 Glad you solved the problem. ;) Agent Ransack blows the doors off of the default Windows search function, IMHO. Many times I searched for things using Windows search and it failed when it should have found something. Agent Ransack hasn't let me down yet. I saw it in another post on this forum. :) If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
rickard_l Posted January 21, 2008 Share Posted January 21, 2008 Hey i get almost the same text in the middle of my store Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/yyy/public_html/osc/includes/header.php:136) in /home/yyy/public_html/osc/includes/boxes/categories.php on line 13 Is that the same thing as you have disscussed? Any suggestions? Should I look with the Agent... software but what should i look for? Please help me, bugs the h**l out of me. The other site works ok, login, creating username and so on but when itäs something with the categories it's this text instead.. Link to comment Share on other sites More sharing options...
germ Posted January 21, 2008 Share Posted January 21, 2008 The error is telling you that the function tep_show_category() is being defined TWICE in your osC code. You need to decide which one you want to keep, and just "comment out" the other. In my code, it's defined in /includes/boxes/categories.php To "comment out" the code for it in /includes/header.php, simply insert this line BEFORE it's definition: /* and this line AFTER it's definition. */ If you need help, post your code. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
randomizeddesign Posted June 17, 2010 Share Posted June 17, 2010 Hi, I have come across the same problem after adding an application Fatal error: Cannot redeclare do_magic_quotes_gpc() (previously declared in /hsphere/local/home/pawlus/nordicjungle.com/catalog/includes/functions/compatibility.php:18) in /hsphere/local/home/pawlus/nordicjungle.com/catalog/includes/functions/compatibility.php on line 18 I have trawled through all of the posts surrounding this issue, downloaded Agent Ransack and found that I have 2 sets of files the seem in admin and in catalog, is this the problem otherwise I have searched for repeats with no luck. I would be happy to post the code from any pages please help, Link to comment Share on other sites More sharing options...
germ Posted June 17, 2010 Share Posted June 17, 2010 The only reason I have found for this error is you've accidentally uploaded a "code" file into the languages folder. Examine all the files in your /includes/languages folder (and sub folders). If you find one that includes or references application_top.php - that's the culprit. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
randomizeddesign Posted June 17, 2010 Share Posted June 17, 2010 thank you so much I found the files 'account' in my languages etc had application_top.php so I put // in front of the code now I have this, what can I do to remove this? 1054 - Unknown column 's.public_flag' in 'where clause' select count(*) as total from orders o, orders_status s where o.customers_id = '4' and o.orders_status = s.orders_status_id and s.language_id = '1' and s.public_flag = '1' [TEP STOP] My Account Information Link to comment Share on other sites More sharing options...
germ Posted June 17, 2010 Share Posted June 17, 2010 Commenting out the line wasn't the correct fix. You should upload the language file that belongs there instead. As for the other problem click this If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.