Web Analytics Made Easy -
StatCounter Using MySQL/PHP on someone's domain. - CodingForum

Announcement

Collapse
No announcement yet.

Using MySQL/PHP on someone's domain.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using MySQL/PHP on someone's domain.

    Hi guys, I need help here...

    You know if you wanna connect to mysql through php in the localhost you just do:

    $db = mysql_connect("localhost", "user", "password");
    mysql_select_db("database", $db);


    Now.. what if I wanna put.. lets say the database on a web space I got from my ISP.

    Questions are:
    Which files do I need to put on the webspace?
    How do I connect to it?
    Do I need to do anything first?

    I am totally clueless when it comes to placing the files outside of my computer >.<.

  • #2
    where you now have
    $db = mysql_connect("localhost", "user", "password");

    you just replace the "localhost" by the eserverIP or name where your mysql db is on. And you of course use the user and passwordname from the mySQL account you got from your host.

    But the account that your host created, must be set up so that you access the mySQL server from the server where your other files are on.

    But most people put their application and db on the same server.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

    Comment


    • #3
      Hm... ok.. so I have to ask the webmaster for the IP, and ask him/her to create an acct for me?

      And how do they set up the account so I can access the server from my computer? then I just place the db where they tell me to?

      Thanx for the help in advance, i'm a newbie in this =).

      Comment


      • #4
        Hmm. First of, let me repeat that most people just upload there PHP-files to the server where the mySQL server is also running on.
        This way, you can still just use the 'localhost' and this is just the easiest setup.

        Originally posted by PenguinJr
        Hm... ok.. so I have to ask the webmaster for the IP, and ask him/her to create an acct for me?
        You need to ask them, if you realy want to have remote acces to the mySQL server. But there is a good chance they will refuse it and instead expect you to upload the PHP files to that server.

        If they do allow it, then you need to supply your IP (must be a fixed IP) or your server-name.
        Originally posted by PenguinJr
        And how do they set up the account so I can access the server from my computer? then I just place the db where they tell me to?
        They will know. It will look like "GRANT ALL ON yourdbname.* TO [email protected]'255.255.255.255'
        more info http://www.mysql.com/doc/en/GRANT.html
        Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

        Comment


        • #5
          Thanx!!!

          Comment

          Working...
          X