Skip to main content
Inspiring
August 17, 2007
Answered

Connecting to a mySQL database (PHP)

  • August 17, 2007
  • 2 replies
  • 454 views
This is driving me nuts now - not least because it's something I've had working in the past.

Basically can't connect, using :

localhost
username
password

Which I've checked countless times now.

I think the problem is with the URL prefix in the testing server part of the site manager - although my hosts have confirmed that it should just be the domain name.

I'm typically getting errors about the URL prefix to the site root not mapping to :

/_mmServerScripts/MMHTTPDB.php

Am I barking up the right tree with this? Anything obvious I've missed?

Cheers.
This topic has been closed for replies.
Correct answer johngordon12
Got it at last - I had the 'Use Passive FTP' box checked - which I think I usually do with no problems. Unchecking it seems to have fixed it.

2 replies

johngordon12AuthorCorrect answer
Inspiring
August 17, 2007
Got it at last - I had the 'Use Passive FTP' box checked - which I think I usually do with no problems. Unchecking it seems to have fixed it.
Inspiring
August 17, 2007
Iain71 wrote:
> I'm typically getting errors about the URL prefix to the site root not mapping
> to :
>
> /_mmServerScripts/MMHTTPDB.php

Have you checked the remote server to see if _mmServerScripts is in the
site root? Sometimes, Dreamweaver can't create the folder and upload the
files because of permissions.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Inspiring
August 17, 2007
It's slightly confusing - although mostly because it's been doing my head in for so long.

Looking in the file manager, the tree structure starts off at the highest level with :

/home/abcdefg/ - where abcdefg is my username for my hosting account, and so my log in name for connecting.

Within there, there are folders including :

_mmServerScripts - this one is empty

public_html - This is what I have as the host directory in DWs site manager for the site.

It also includes a _mmServerScripts sub folder - this one containing :

MMHTTPDB.php - a blank file
mysql.php - connection type info, but nothing particular, eg code starting :

<?php
class MySqlConnection
{
var $isOpen;
var $hostname;
var $database;
var $username;
var $password;
var $timeout;
var $connectionId;

function MySqlConnection($ConnectionString, $Timeout, $Host, $DB, $UID, $Pwd)
{
$this->isOpen = false;
$this->timeout = $Timeout;

if( $Host ) {
$this->hostname = $Host;
}
elseif( ereg("host=([^;]+);", $ConnectionString, $ret) ) {
$this->hostname = $ret[1];
}

if( $DB ) {
$this->database = $DB;
}
elseif( ereg("db=([^;]+);", $ConnectionString, $ret) ) {
$this->database = $ret[1];
}

if( $UID ) {
$this->username = $UID;
}
elseif( ereg("uid=([^;]+);", $ConnectionString, $ret) ) {
$this->username = $ret[1];
}

if( $Pwd ) {
$this->password = $Pwd;
}
elseif( ereg("pwd=([^;]+);", $ConnectionString, $ret) ) {
$this->password = $ret[1];
}
}

function Open()
{
// if ($this->connectionId = mysql_connect($this->hostname, $this->username, $this->password) or die(mysql_error()))
if ($this->connectionId = mysql_connect($this->hostname, $this->username, $this->password))
{
$this->isOpen = ($this->database == "") ? true : mysql_select_db($this->database, $this->connectionId);
}
else
{

------

What exactly is Dreamweaver trying to do - create those two files above, with the connection details, and upload them to the correct folder on the server?

With permissions, where should I be looking to set these?

I've been on to my host's support, and they've been talking about IP addresses and entering them so that I can connect remotely etc?

The really annoying thing is that a site I did previously worked fine, without - I'm pretty sure - any of this IP stuff, ie I just had 'localhost' as the mySQL server.