Jump to content

A connection attempt failed


squiblo

Recommended Posts

All my web pages connect to MySQL before the html tag by including a php file like so...

 

<?php
session_start();
require_once "php/connections/dbconnect.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" id="#top">
<head>

 

All pages connect successfully apart from one, that does not manage to connect about 1 in 5 times. This is the error that I am getting...

 

  Quote

Warning: mysql_connect() [function.mysql-connect]: [2002] A connection attempt failed because the connected party did not properly respond after a period of time, or established connecti (trying to connect via tcp://46.183.8.87:3306) in C:\xampp\htdocs\socialnews\php\connections\dbconnect.php on line 3

 

Warning: mysql_connect() [function.mysql-connect]: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\xampp\htdocs\socialnews\php\connections\dbconnect.php on line 3

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

 

And this is the contents on the dbconnect.php...

 

<?php
//CONNECT TO DATABASE
$connect = mysql_connect("*****", "*****", "*****") or die(mysql_error());
$db = mysql_select_db("*****", $connect) or die(mysql_error());
?>

 

I have no idea where to start looking because it's such a strange problem. Any idea of what I need to check? Any tips will be appreciated!

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/255287-a-connection-attempt-failed/
Share on other sites

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.