View Full Version : Database connection with php and MySQL

12-22-2005, 10:59 PM
I have been having quite a time connecting to a MySQL DB with PHP. I get all of the site info set up correctly and the remote server connects and tests fine but when I try to set up the connection I get "An unidentified error has occured"

connection name: dbConnect
MySQL server: localhost
Password XXXXXXX
Database: XXXXXX

ANy ideas????

Really frustrating....

Creative Insanity
12-22-2005, 11:41 PM
Yes this is VERY frustrating and I think we have all been through this.
So I take it you have a connection script setup such as this:

$hostname_phpdesk = "localhost";
$database_phpdesk = "databasek";
$username_phpdesk = "user";
$password_phpdesk = "password";
$phpdesk = mysql_pconnect($hostname_phpdesk, $username_phpdesk, $password_phpdesk) or trigger_error(mysql_error(),E_USER_ERROR);
And you have the include at the top of the file you are trying to connect with.

I don't know your precise problem is since I do not know your system but what I normally do before I even touch the connection part is setup phpmyadmin and get that working 100% with no errors first and then this tells me that I have MySQL setup and working correctly.
Then when I get an error I know it is not the setup and the connection would have to be a connection script error or an error in the script.
This way you know where to trouble shoot.

12-23-2005, 02:17 AM
I know that phpmyadmin works fine because I initailly set it up that way. I am trying now to use the DB connectivity of DW and this is were it gets frustrating....

12-23-2005, 07:41 AM
make sure all your _script directories that DW creates on your local machine are copied onto the remote site

12-23-2005, 09:20 PM
Did that as well.

Here is the info as I have it

http://www.saskdietitians.org/ ('http://www.saskdietitians.org/')

Remote Info
FTP Access
FTP host: saskdietitians.org
login: XXXXXXX

Testing Server: PHP MySQL
Access: FTP
FTP Host: saskdietitians.org
Password: XXXXXXX

Connection Info
Connection Name: SDAconn
MySQL server: localhost (using a PC)
Username: XXXXX
Password: XXXXXX
Database: saskdiet

This just sucks!! I have been able to create connections for ASP noproblem but this one just won't go!!!

12-25-2005, 06:32 PM
Bumping this one up...Please help!!!!

12-25-2005, 06:50 PM
One more time...

Creative Insanity
12-25-2005, 10:51 PM
Remember the season and most are away somewhere. No more bumps please. :)

12-28-2005, 09:41 AM
this happened to me a while ago and i resolved it by copying the _mmServerScripts and its contents from the local directory to the test server

this resolved it for me

12-29-2005, 09:45 PM
Hey David J,

Do you develop locally first and then upload?? I am thinking that this may be the best way to get it done, although I will have to install php and mysql on my machine here.

Creative Insanity
12-29-2005, 10:48 PM
I myself have my own development server here (seperate system) which runs Linux and all sites are done locally and then uploaded or packed in an installer for whom ever they are for.

12-30-2005, 04:17 PM
I have php/mysql installed locally and use it for testing then I upload to the host. If you do it this way, though, you will need to set up 2 connections, one for the local testing server and one for the remote host, or at least edit the connection script that you use.

Have you tried un-checking the option in sever compatibility in the site management tool for the remote site?

01-18-2006, 08:05 PM
Just an update.
I installed Apache, PHP5, MySQL and PhPMYADMIN on my machine and the connection works fine now.

Thanks for all the help!!