Results 1 to 8 of 8

Thread: Getting Started

  1. #1
    Join Date
    Oct 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Getting Started

    Alright, I cannot seem to connect to my godaddy.com database for the life of me. I'm pretty sure I'm just confused in all the syntax - any help would be great! The farthest I've gotten from online help is this:

    Code:
    <?php
    //Sample Database Connection Syntax for PHP and MySQL.
    
    //Connect To Database
    $hostname="mysql.secureserver.net";
    $username="your_dbusername";
    $password="your_dbpassword";
    $dbname="your_dbusername";
    $usertable="your_tablename";
    $yourfield = "your_field";
    $connection = mysql_connect("$hostname", "$username", "$password");
    mysql_select_db("$databasename", $con);
    
    # Check If Record Exists
    
    $query = "SELECT * FROM $usertable";
    
    $result = mysql_query($query);
    
    if($result)
    {
    while($row = mysql_fetch_array($result))
    {
    $name = $row["$yourfield"];
    echo "Name: ".$name."
    ";
    }
    }
    ?>

    I know that I replace username, password, and dbname. I don't actually have any tables.. so I'm not sure what to do with everything else - and also, did I need to change the $hostname?? I'm so lost - everything I try results in 'Error connecting to mysql database.' Thanx for any help.

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Chances are the database is going to be on the same server as the data files, so try "localhost" as the $host

    provided your username / password is correct for the database, if that doesnt work, then you are going to need to contact your provider's tech support and have them help you troubleshoot

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    mysql#.secureserver.net, such as mysql7, etc.
    Godaddy uses separate servers so you will have to log in remotely. Not the easiest setup, but it works out once you know the right connection.
    It took me a while to figure that out; I believe it should be possible to see in your cpanel. I think the phpmyadmin page may also give away that number, but, then again, they might vary it for security reasons. Quite annoying.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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

    Default No Cigar

    Thank you very much for your replies! I'm getting there.. but not quite connected or inserting any data. I've finally found godaddy's hostname and rearranged my php file to look more like this:

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

    //Connect To Database
    $dbhost "p41mysql97.secureserver.net";
    $dbname "test7777";
    $dbuser "test7777";
    $dbpass "test7777";

    mysql_connect($dbhost,$dbuser,$dbpass)or die("Could not connect: ".mysql_error());
    mysql_select_db($dbname) or die(mysql_error());


    ?>

    but this is the rejection I get:
    Could not connect: Client does not support authentication protocol requested by server; consider upgrading MySQL client

    any ideas what this means??

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Your host needs to upgrade their MySQL client libraries/PHP extensions to match the server.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Oct 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default You're Right

    AHHHHH! You're right! I finally understand why none of my php scripts would work - the cheap account my client got doesn't support them! Well, whoever said go to them directly and ask for support, you're right. I need to figure out some other sort of script (i've written a few asp scripts, but as I understand it, I need to use asp.NET?). Anyway, sorry to annoy any of you advanced guys - and thanx a lot for the help!

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    My experience with godaddy is simple-- it's cheap and works very smoothly, for what is in fact setup. There are some hindrances, such as only one ftp user per IP at one time, odd PHP stuff, etc., but if those don't hurt you, then it's great. Anything you need customized, fixed, updated, etc., will be a huge pain though, as the tech support is near worthless-- you call, wait an hour, just to realize they are reading the support files on their site and really don't know anything about PHP, etc. Sometimes you'll push enough and get a manager of some sort, who will just explain something in a vague, confusing way, and it won't really get anywhere.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Sometimes you'll push enough and get a manager of some sort, who will just explain something in a vague, confusing way, and it won't really get anywhere.
    Probably meaning that they don't understand it either. I don't think I'd entrust my files to a company that doesn't understand the technology that is the basis of their business.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •