Jump to content

Connection Error, I can't for the life of me figure out the reason...


FreeMyPain

Recommended Posts

I keep getting a connection error to the Mysql database.. I know that the error shows that it can't connect, the reason that's confusing me is why? I have the connection.class.php file configured correctly.. the connection is even used on the page.. with something else.. I'm doing the exact same thing as I'm doing on another page and on the other page it's working fine.

 

The Error :

 

Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2) in php/connection.class.php on line 20

 

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in php/connection.class.php on line 20

Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2)

 

This creates a new connection.. from my class..

 

$connection = new Connect(); 

 

It calls this..

function Query( $sql )
{
  $query = mysql_query( $sql ) or die(mysql_error());
  return $query;
}

 

This is the line of code from login.php that is giving me the error :

$result = $connection->Query("SELECT password FROM user_database WHERE username='$username'");

 

This is the line of code from create.php that is working :

$result = $connection->Query("SELECT username FROM user_database WHERE username='$username'");

 

They both look identical to me, the code must be fine? I'm hosted with godaddy and have 5 tables in the database.. do they use different servers?(how)? If anybody can think of any reason this is happening it'll be useful....

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.