Results 1 to 7 of 7

Thread: Connection problem with Dreamweaver

  1. #1
    Join Date
    Jan 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Connection problem with Dreamweaver

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

  2. #2
    Join Date
    Oct 2007
    Posts
    43
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    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.

  3. #3
    Join Date
    Jul 2008
    Location
    Redmond, WA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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?

  4. #4
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    Here is GoDaddy's connection sample:

    Code:
    <?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. (?)

  5. #5
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    That code is wrong, well atleast the javascript is. It should be this:
    Code:
    <?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);
    
    ?>
    Jeremy | jfein.net

  6. #6
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    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.

  7. #7
    Join Date
    Jul 2008
    Location
    Redmond, WA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •