The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> database connection
minidiapolis
post Oct 4 2011, 01:36 PM
Post #1


Serious Coder
*****

Group: Members
Posts: 437
Joined: 3-September 06
Member No.: 57



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Oct 4 2011, 02:33 PM
Post #2


WDG Member
********

Group: Root Admin
Posts: 8,033
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



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


--------------------
Darin McGrew
WDG Member since 1998
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Frederiek
post Oct 5 2011, 01:57 AM
Post #3


Programming Fanatic
********

Group: Members
Posts: 4,542
Joined: 23-August 06
From: Europe
Member No.: 9



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


--------------------
"The earth does not belong to us. We belong to the earth."
from Vue du ciel (in French)

"Leave scepticism to others and take action"
from HOME by Goodplanet

An inconvenient truth by Al Gore
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 5 2011, 08:14 AM
Post #4


.
********

Group: WDG Moderators
Posts: 6,300
Joined: 10-August 06
Member No.: 7



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


--------------------
User is online!PM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 22nd December 2014 - 04:22 PM