Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

CAN ANYONE TELL ME WHAT TO CHANGE?


hijabistyle

Recommended Posts

MY SITE IS DEAD. IF YOU CLICK ON ANY LINK, YOU WILL GET THIS MESSAGE:

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/www/hijabistyle.com/shop/catalog/includes/functions/database.php on line 19

Unable to connect to database server!

 

THIS IS THE DATABASE.PHP FILE.....what should i change and what should i change it to??? any help is appreciated.

_______________________________

 

 

 

<?php

/*

$Id: database.php 1739 2007-12-20 00:52:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2007 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($link = 'db_link') {

global $$link;

 

return mysql_insert_id($$link);

}

 

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, $link = 'db_link') {

global $$link;

 

if (function_exists('mysql_real_escape_string')) {

return mysql_real_escape_string($string, $$link);

} elseif (function_exists('mysql_escape_string')) {

return mysql_escape_string($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

MY SITE IS DEAD. IF YOU CLICK ON ANY LINK, YOU WILL GET THIS MESSAGE:

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/www/hijabistyle.com/shop/catalog/includes/functions/database.php on line 19

Unable to connect to database server!

If this was a working site, then there is problem with the database. It might be a server problem so you should contact your host first. If it is a database problem, it might be recoverable but you need to determine which it is first.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Go into phpmyadmin and run a repair on the database. That assumes the datavase is there but corrupted. If it is not there, then you can't repair it. You will need to replace it in that case. Your host may keep backups if you don't have one.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

This means that your database needs looking at by your host.

 

You, and everyone else, should also make these error messages more suitable for your visitors - a message such as

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/www/hijabistyle.com/shop/catalog/includes/functions/database.php on line 19
is hardly good for people who find your site, think "amateurs" and never return to make a purchase.

 

See www.clubosc.com/mysql-server-down-oh-no.html

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...