{"id":915,"date":"2018-03-04T00:11:34","date_gmt":"2018-03-04T00:11:34","guid":{"rendered":"https:\/\/webhostingplus.uk\/hosting\/?p=915"},"modified":"2018-03-04T00:11:34","modified_gmt":"2018-03-04T00:11:34","slug":"connect-another-database-another-server-php-script","status":"publish","type":"post","link":"https:\/\/webhostingplus.uk\/hosting\/connect-another-database-another-server-php-script\/","title":{"rendered":"How do I connect to another database on another server from my PHP script?"},"content":{"rendered":"<p>A connection is made to a database with the usual statement: <\/p>\n<p>mysql_connect(&#8216;localhost&#8217;,&#8217;USERNAME&#8217;,&#8217;PASSWORD&#8217;); <\/p>\n<p>Where &#8216;localhost&#8217; is the database on the same web server as the PHP script. <\/p>\n<p>If you want to connect to a database to another web server you would replace localhost&#8217; to that of the IP address of the web server. <\/p>\n<p>The web server where a database resides can be found by moving your mouse over the &#8220;Go&#8221; link for the Temp Web Address or clicking the link so the IP is displayed in the browser address bar, within the Web Hosting Plus control panel. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>A connection is made to a database with the usual statement: mysql_connect(&#8216;localhost&#8217;,&#8217;USERNAME&#8217;,&#8217;PASSWORD&#8217;); Where &#8216;localhost&#8217; is the database on the same web server as the PHP script. If you want to connect to a database to another web server you would replace localhost&#8217; to that of the IP address of the web server. The web server &#8230; <a title=\"How do I connect to another database on another server from my PHP script?\" class=\"read-more\" href=\"https:\/\/webhostingplus.uk\/hosting\/connect-another-database-another-server-php-script\/\" aria-label=\"Read more about How do I connect to another database on another server from my PHP script?\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-915","post","type-post","status-publish","format-standard","hentry","category-php-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How do I connect to another database on another server from my PHP script? - Web Hosting Plus<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webhostingplus.uk\/hosting\/connect-another-database-another-server-php-script\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How do I connect to another database on another server from my PHP script? - Web Hosting Plus\" \/>\n<meta property=\"og:description\" content=\"A connection is made to a database with the usual statement: mysql_connect(&#8216;localhost&#8217;,&#8217;USERNAME&#8217;,&#8217;PASSWORD&#8217;); Where &#8216;localhost&#8217; is the database on the same web server as the PHP script. If you want to connect to a database to another web server you would replace localhost&#8217; to that of the IP address of the web server. The web server ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webhostingplus.uk\/hosting\/connect-another-database-another-server-php-script\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting Plus\" \/>\n<meta property=\"article:published_time\" content=\"2018-03-04T00:11:34+00:00\" \/>\n<meta name=\"author\" content=\"webhostingplus\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webhostingplus\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/connect-another-database-another-server-php-script\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/connect-another-database-another-server-php-script\\\/\"},\"author\":{\"name\":\"webhostingplus\",\"@id\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/#\\\/schema\\\/person\\\/ac818f1a9ee343e82657049f7c97c9dc\"},\"headline\":\"How do I connect to another database on another server from my PHP script?\",\"datePublished\":\"2018-03-04T00:11:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/connect-another-database-another-server-php-script\\\/\"},\"wordCount\":114,\"publisher\":{\"@id\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/#organization\"},\"articleSection\":[\"PHP Scripting\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/connect-another-database-another-server-php-script\\\/\",\"url\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/connect-another-database-another-server-php-script\\\/\",\"name\":\"How do I connect to another database on another server from my PHP script? - Web Hosting Plus\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/#website\"},\"datePublished\":\"2018-03-04T00:11:34+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/connect-another-database-another-server-php-script\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/connect-another-database-another-server-php-script\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/connect-another-database-another-server-php-script\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How do I connect to another database on another server from my PHP script?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/#website\",\"url\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/\",\"name\":\"Web Hosting Plus\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/#organization\",\"name\":\"Web Hosting Plus\",\"url\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/wp-content\\\/uploads\\\/Web-Hosting-Plus-Logo.png\",\"contentUrl\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/wp-content\\\/uploads\\\/Web-Hosting-Plus-Logo.png\",\"width\":339,\"height\":78,\"caption\":\"Web Hosting Plus\"},\"image\":{\"@id\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/webhostingplus.uk\\\/hosting\\\/#\\\/schema\\\/person\\\/ac818f1a9ee343e82657049f7c97c9dc\",\"name\":\"webhostingplus\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How do I connect to another database on another server from my PHP script? - Web Hosting Plus","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webhostingplus.uk\/hosting\/connect-another-database-another-server-php-script\/","og_locale":"en_GB","og_type":"article","og_title":"How do I connect to another database on another server from my PHP script? - Web Hosting Plus","og_description":"A connection is made to a database with the usual statement: mysql_connect(&#8216;localhost&#8217;,&#8217;USERNAME&#8217;,&#8217;PASSWORD&#8217;); Where &#8216;localhost&#8217; is the database on the same web server as the PHP script. If you want to connect to a database to another web server you would replace localhost&#8217; to that of the IP address of the web server. The web server ... Read more","og_url":"https:\/\/webhostingplus.uk\/hosting\/connect-another-database-another-server-php-script\/","og_site_name":"Web Hosting Plus","article_published_time":"2018-03-04T00:11:34+00:00","author":"webhostingplus","twitter_card":"summary_large_image","twitter_misc":{"Written by":"webhostingplus","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webhostingplus.uk\/hosting\/connect-another-database-another-server-php-script\/#article","isPartOf":{"@id":"https:\/\/webhostingplus.uk\/hosting\/connect-another-database-another-server-php-script\/"},"author":{"name":"webhostingplus","@id":"https:\/\/webhostingplus.uk\/hosting\/#\/schema\/person\/ac818f1a9ee343e82657049f7c97c9dc"},"headline":"How do I connect to another database on another server from my PHP script?","datePublished":"2018-03-04T00:11:34+00:00","mainEntityOfPage":{"@id":"https:\/\/webhostingplus.uk\/hosting\/connect-another-database-another-server-php-script\/"},"wordCount":114,"publisher":{"@id":"https:\/\/webhostingplus.uk\/hosting\/#organization"},"articleSection":["PHP Scripting"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/webhostingplus.uk\/hosting\/connect-another-database-another-server-php-script\/","url":"https:\/\/webhostingplus.uk\/hosting\/connect-another-database-another-server-php-script\/","name":"How do I connect to another database on another server from my PHP script? - Web Hosting Plus","isPartOf":{"@id":"https:\/\/webhostingplus.uk\/hosting\/#website"},"datePublished":"2018-03-04T00:11:34+00:00","breadcrumb":{"@id":"https:\/\/webhostingplus.uk\/hosting\/connect-another-database-another-server-php-script\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webhostingplus.uk\/hosting\/connect-another-database-another-server-php-script\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webhostingplus.uk\/hosting\/connect-another-database-another-server-php-script\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webhostingplus.uk\/hosting\/"},{"@type":"ListItem","position":2,"name":"How do I connect to another database on another server from my PHP script?"}]},{"@type":"WebSite","@id":"https:\/\/webhostingplus.uk\/hosting\/#website","url":"https:\/\/webhostingplus.uk\/hosting\/","name":"Web Hosting Plus","description":"","publisher":{"@id":"https:\/\/webhostingplus.uk\/hosting\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webhostingplus.uk\/hosting\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/webhostingplus.uk\/hosting\/#organization","name":"Web Hosting Plus","url":"https:\/\/webhostingplus.uk\/hosting\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/webhostingplus.uk\/hosting\/#\/schema\/logo\/image\/","url":"https:\/\/webhostingplus.uk\/hosting\/wp-content\/uploads\/Web-Hosting-Plus-Logo.png","contentUrl":"https:\/\/webhostingplus.uk\/hosting\/wp-content\/uploads\/Web-Hosting-Plus-Logo.png","width":339,"height":78,"caption":"Web Hosting Plus"},"image":{"@id":"https:\/\/webhostingplus.uk\/hosting\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/webhostingplus.uk\/hosting\/#\/schema\/person\/ac818f1a9ee343e82657049f7c97c9dc","name":"webhostingplus"}]}},"_links":{"self":[{"href":"https:\/\/webhostingplus.uk\/hosting\/wp-json\/wp\/v2\/posts\/915","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostingplus.uk\/hosting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostingplus.uk\/hosting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostingplus.uk\/hosting\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostingplus.uk\/hosting\/wp-json\/wp\/v2\/comments?post=915"}],"version-history":[{"count":0,"href":"https:\/\/webhostingplus.uk\/hosting\/wp-json\/wp\/v2\/posts\/915\/revisions"}],"wp:attachment":[{"href":"https:\/\/webhostingplus.uk\/hosting\/wp-json\/wp\/v2\/media?parent=915"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostingplus.uk\/hosting\/wp-json\/wp\/v2\/categories?post=915"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostingplus.uk\/hosting\/wp-json\/wp\/v2\/tags?post=915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}