Jump to content

PHP Error Message Stumped


dcshoeco1

Recommended Posts

I Installed a script onto my server at godaddy. I set up the mysql database correctly im pretty sure about it. Anyway im testing out my site and making changes and when I click on one of the button that says "myaccount" Im getting this message

 

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/d/c/s/dcshoeco1/html/myaccount.php on line 5

 

Warning: mysql_select_db(): Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/d/c/s/dcshoeco1/html/myaccount.php on line 6

 

Warning: mysql_select_db(): A link to the server could not be established in /home/content/d/c/s/dcshoeco1/html/myaccount.php on line 6

Unable to connect to MySQL

 

 

When I take a look at my account.php Lines 5 and 6 say this

$conn=mysql_connect($dbhost, $dbuser, $dbpass);

mysql_select_db($dbname) or die ("Unable to connect to MySQL");

 

Everything else is working fine on my site so far Im new to PHP can someone help me in fixing this. Thanks :)

 

 

Link to comment
https://forums.phpfreaks.com/topic/49239-php-error-message-stumped/
Share on other sites

Im stumped this is exactly what I have in my site

 

For DBsetts.php

<?

$dbhost="p50mysql25.secureserver.net";

$dbname="XXXX";

$dbuser="XXXX";

$dbpass="XXXXXXX";

?>

 

And For My account.php I have this

<tr>

<td width="540" height="25" align="right" valign="middle" background="/images/modtitle-myfavs.gif"> </td>

</tr>

<?

$conn=mysql_connect($dbhost, $dbuser, $dbpass);

mysql_select_db($dbname) or die ("Unable to connect to MySQL");

// print "Connected to MySQL";

 

$qresult2 = mysql_query("SELECT * FROM t_favs WHERE u_id=$userID ORDER BY f_dateadded DESC");

 

if (!$qresult2) {

  die('Invalid query: ' . mysql_error());

}

 

while ($line2 = mysql_fetch_assoc($qresult2)){

 

$qresult = mysql_query("SELECT * FROM t_media WHERE m_id=".$line2["m_id"]." ORDER BY m_id DESC LIMIT 1");

 

if (!$qresult) {

  die('Invalid query: ' . mysql_error());

}

 

while ($line = mysql_fetch_assoc($qresult)){

?>

 

<? include("showitem.php"); ?>

 

<? }

}

 

mysql_close($conn);

?>

 

 

What do I have to change i contacted Godaddy and they were no help

 

Can't see it from the section of script you posted but i assuming you did include DBsetts.php in your script.

 

Try add the following to see if you get a better error on why its not connecting.

<?php
$conn=mysql_connect($dbhost, $dbuser, $dbpass);
if (!$conn) {
    die('Could not connect: ' . mysql_error());
}
?>

Archived

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

×
×
  • 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.