Connecting MAMP to GoDaddy hosted MySQL database

Discussion in 'Web Design and Development' started by Bostonaholic, Dec 8, 2009.

  1. Bostonaholic macrumors 6502

    Bostonaholic

    Joined:
    Aug 21, 2009
    Location:
    Columbus, Ohio
    #1
    I've got my website and database hosted by GoDaddy. I just got off the phone with Customer Support and they're unable to give me an answer (I don't believe he understands my problem).

    I have my website running through MAMP locally. I want to be able to connect to my hosted database at GoDaddy while I test it locally. Unfortunately, the mysql_connect fails when running locally but if I ftp the files to the GoDaddy hosting, it connects fine.

    index.php
    PHP:
    <?php
    ...
     require(
    "dbconnect.php");
    ...
    ?>
    dbconnect.php
    PHP:
    <?php
    //Connect To Database
    $hostnmae='<hidden>';
    $username='<hidden>';
    $password='<hidden>';
    $dbname='<hidden>';

    mysql_connect($hostname,$username,$password) OR DIE ('Unable to connect to database! Please try again later.');
    mysql_select_db($dbname);
    ?>
    Anyone have experience with GoDaddy hosted databases?

    Thanks for your help.
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    $hostname is misspelled. If that was just a typo here only, describe what hostname looks like as that's likely where the issue is.
     
  3. Bostonaholic thread starter macrumors 6502

    Bostonaholic

    Joined:
    Aug 21, 2009
    Location:
    Columbus, Ohio
    #3
    SON OF A B*TCH!!!!

    Do you know how long this have been bugging me? Thanks. But I wonder why it was able to connect after uploading to the site. Something's screwy.

    Anyway, it works. Thanks a lot.


    P.S. And the guy at GoDaddy said to "Google it, everyone here doesn't have an answer so we must not support it."
     
  4. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
  5. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #5
    I almost didn't see it either, I looked back to see how you spelled it to make sure I referenced it correctly in my post and that's when I saw the misspelling. Glad that was the extent of the problem.

    It's pretty bad your host couldn't help with this. The techy people must have been out sick.
     

Share This Page