Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Databases _ database connection

Posted by: minidiapolis Oct 4 2011, 01:36 PM

what 's wrong with the following code ?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
$host = "localhost";
$username = "ZXXics";
$password = "XXXXXX711";

$connection = mysql_connect($host,$username,$password)
or die("connection could not be established");
?>
</body>
</html>

I'm getting this error

Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'localhost' (10061) in D:\Hosting\5246561\html\treats.php on line 14
connection could not be established

Posted by: Darin McGrew Oct 4 2011, 02:33 PM

Perhaps this will help:
http://dev.mysql.com/doc/refman/5.5/en/can-not-connect-to-server.html

Posted by: Frederiek Oct 5 2011, 01:57 AM

And
- http://php.net/manual/en/function.mysql-connect.php
- http://devzone.zend.com/node/view/id/641

Posted by: Christian J Oct 5 2011, 08:14 AM

In some cases it seems the user name must be "root".

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)