PDA

View Full Version : Database connection with php and MySQL


kona72
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
UserName: XXXXXXX
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:

<?php
$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.

kona72
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....

davidj
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

kona72
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
Password:XXXXX

Testing Server: PHP MySQL
Access: FTP
FTP Host: saskdietitians.org
Login: XXXXXX
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!!!

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

kona72
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. :)

davidj
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

kona72
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.

desertdirk
12-30-2005, 04:17 PM
Kona
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?

kona72
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!!