SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast knojiyak's Avatar
    Join Date
    Oct 2013
    Posts
    69
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Mysql Connection File

    Hello Guys,

    There is a new problem which i m facing.

    The question is that.

    How to Connect two databases on two different servers using php ?

    I hope it possible. if is it possible please someone tell me how will i do......

    Thank you
    Best Regards,
    Kewal Knojiya
    Kewal | Kanojia | Kewal Kanojia | PHP Web Developer

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,863
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    You connect to both the same way - just use a different field to hold the connection pointer.

    The four parameters to pass to set up the connection are userid, password, server and database. You might also need to make sure that the appropriate port is open when connecting to a database on a server other than localhost.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Enthusiast knojiyak's Avatar
    Join Date
    Oct 2013
    Posts
    69
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Can you tell me which parameters is pass in server and how.
    Best Regards,
    Kewal Knojiya
    Kewal | Kanojia | Kewal Kanojia | PHP Web Developer

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,863
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by knojiyak View Post
    Can you tell me which parameters is pass in server and how.
    Either a domain name or an ip address (without any protocol on the front. You may need to add the mysql port number on the end after a colon.

    For example if the database is on the same server as the PHP then use either 'localhost' or '127.0.0.1' or your domain name. For a remote server use the ip address of that server or the domain name eg. 'example.com'
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    SitePoint Enthusiast knojiyak's Avatar
    Join Date
    Oct 2013
    Posts
    69
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    can we axis server database from localhost using this method and how i got the ip address of domain name.
    Best Regards,
    Kewal Knojiya
    Kewal | Kanojia | Kewal Kanojia | PHP Web Developer


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
  •