muttsnuts Posted October 18, 2005 Share Posted October 18, 2005 Hi I have just installed a template which is ok but now I can't use the admin section. I receive the following error: Warning: mysql_connect(): Access denied for user: 'root@localhost' (Using password: NO) in /public_html/catalog/admin/includes/functions/database.php on line 19 Unable to connect to database server! I haven't the faintest idea what this means but if it helps then here is the complete code from that page: <?php /* $Id: database.php,v 1.23 2003/06/20 00:18:30 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, $logger; if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) { if (!is_object($logger)) $logger = new logger; $logger->write($query, 'QUERY'); } $result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error()); if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) { if (mysql_error()) $logger->write(mysql_error(), 'ERROR'); } 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_result($result, $row, $field = '') { return mysql_result($result, $row, $field); } 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(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; } } ?> Please help, I have only installed a template now it appears I have screwed my site again. Link to comment Share on other sites More sharing options...
muttsnuts Posted October 18, 2005 Author Share Posted October 18, 2005 I urgently need help with this problem. I have replaced the file concerned and the problem remains. I don't think there is a problem with the database, the main store is still accessing it as all the products are listed. If you need to see then visit: http://www.bakerloo-aslef.co.uk/catalog/admin Link to comment Share on other sites More sharing options...
muttsnuts Posted October 18, 2005 Author Share Posted October 18, 2005 I've just checked and now my store front has the very same error so it would possibly appear that oscommerce has lost the information it requires to access the database. How do I repair this? Please help if you can. I can't believe that these problems have come about by installing a template (not from this site I would like to add). I really do not want to do a fresh install if it is not needed. Any Suggestions? Link to comment Share on other sites More sharing options...
Guest Posted October 18, 2005 Share Posted October 18, 2005 yes make sure the catalog\admin\includes\configure.php file has all the correct information to login to the database. Don't post the dbase information here because it includes password and username of your store Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.