PDA

View Full Version : Connection problem with Dreamweaver



jmcldesigns
01-21-2008, 03:27 PM
I am very new to mysql and php but not to Dreamweaver so please consider that if my question is poorly stated.

I am working on a site that needs a database. I am hosting with godaddy. I have created the database on godaddy and on my localhost. I have created my pages and have successfully tested on my testing site (local machine MAC with OSX). However, I cannot get the connection syntax correct for godaddy. My pages display blank.

Dreamweaver want's to create a connections file in the /connections folder which appears to be called from the page. Except for the connection syntax is this what will work on godaddy or does the connection need to be in the page itself? More importantly, what IS the syntax of the file.

I saw a post from another subscriber who had the same problem and indicated that he had solved it with the correct connection. However, the solution was not presented.

Please help !!!!

marynorn
01-24-2008, 01:09 PM
In the Applications side box, select the Database tab and hit the plus sign. Then hit 'MySQL Connection' and add your database details to the popup box.

Mike in Redmond
07-30-2008, 10:21 PM
I am also having trouble with the connection syntax with Godaddy using php and mysql. I have the app running on my local machine with mysql and I would now like to redirect the app to look at the Godaddy mysql db when I upload it - transfer from testing to production. The nebulex.com tutorial says to forget it if you are using godady but the post above says you can do it. I have used the developers toolbox wizards for many db connections. Do I need to convert the database definitions every time I work with the site local and then back to godaddy when I want to upload it?

kuau
07-31-2008, 05:09 AM
Here is GoDaddy's connection sample:


<?php
//Sample Database Connection Syntax for PHP and MySQL.

//Connect To Database

$hostname="your_mysqlserver.secureserver.net";
$username="your_dbusername";
$password="your_dbpassword";
$dbname="your_dbusername";
$usertable="your_tablename";
$yourfield = "your_field";

mysql_connect($hostname,$username, $password) OR DIE ("<html><script language='JavaScript'<alert('Unable to connect to database! Please try again later.'),history.go(-1)</script></html>");
mysql_select_db($dbname);

?>


Just fill in your password etc, save it as connectdb.php (or whatever), and include it at the top of the files that need to access the database. You could use an if statement to determine whether you were working locally or on GoDaddy.

Maybe I'm misunderstanding what you are asking. (?)

Nile
07-31-2008, 05:11 AM
That code is wrong, well atleast the javascript is. It should be this:


<?php
//Sample Database Connection Syntax for PHP and MySQL.

//Connect To Database

$hostname="your_mysqlserver.secureserver.net";
$username="your_dbusername";
$password="your_dbpassword";
$dbname="your_dbusername";
$usertable="your_tablename";
$yourfield = "your_field";

mysql_connect($hostname,$username, $password) OR DIE ("<html><script language='JavaScript'>
alert('Unable to connect to database! Please try again later.');
history.go(-1);</script></html>");
mysql_select_db($dbname);

?>

kuau
07-31-2008, 05:17 AM
I just cut and pasted it verbatim from GoDaddy. Maybe that's why he was having trouble. I don't use js in my connection strings so didn't even look at that part. Anyway, thanks for fixing it. I don't like GoDaddy as a host and have found their tech support to be pathetic, so it doesn't surprise me that their knowledgebase samples would be inaccurate. Par for the course.

Mike in Redmond
07-31-2008, 06:23 AM
Thank you Nile and Kuau. I saw this on the Godaddy site but did not how to integrate it with the Dreamweaver Toolbox. If I include the the connectdb.php will the rest of the toolbox functionality still work or do you develop in native php?

Mike