This article explains how to connect multiple MySQL databases into a single webpage. It is useful to access data from multiple databases.
There are two methods to connect multiple MySQL databases into a single webpage which are:
- Using MySQLi (Improved version of MySQL)
- Using PDO (PHP Data Objects)
- MySQLi Procedural syntax:
$link = mysqli_connect( “host_name”, “user_name”, “password”, “database_name” );
- MySQLi Object Oriented syntax:
$link = new mysqli( “host_name”, “user_name”, “password”, “database_name” );
- PDO (PHP Data Objects) syntax:
$pdo = new PDO( “mysql:host=host_name; dbname=database_name”, “user_name”, “password” );
Program: This program uses MySQLi to connect multiple databases on a single webpage.
- Nodejs – Connect Mysql with Node app
- MySQL | Common MySQL Queries
- How to redirect to another webpage in HTML?
- How to Add Google Charts on a Webpage?
- How To Add Google Translate Button On Your Webpage?
- How to Add Apple's new San Francisco font on a Webpage using CSS ?
- Reader's View of a GeeksforGeeks webpage
- How to click a button on webpage using selenium ?
- How to get title of a webpage using Selenium in Python?
- Reading selected webpage content using Python Web Scraping
- Working with Databases in R Programming
- HTML DOM indexedDB databases() Method
- How to Connect Two Monitors?
- How to connect the Database with PHP DOM page ?
- How to connect Django with Reactjs ?
- How to Connect Two Computers with an Ethernet Cable?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.