Select on two diffents databases

asdriel

Member
Apr 26, 2019
198
17
18
www.bantu-2rsn.com
Is there a way to search product on two different websites?
I mean, i have two sites and two databases, so i want to search both products on each site.

is there any soluction??
 
  • Like
Reactions: ibrahim

drxp123

Active member
Sep 6, 2019
156
60
28
Make one database for both sites and do the same column for product attributes. that's the best solution. also if you have same design you can white label your website
 

nakuk

New member
Oct 17, 2019
25
11
3
UK
if the databases are on the same server you could create a view - combining product records from Site 1 and Site 2 into the view and then run the new product search against that view.
 

djjogy

Member
Aug 22, 2019
89
68
18
join 2 database to one
exemplar
PHP:
<?php
$pdo = new PDO('mysql:host=localhost;dbname=databaseA', 'root', 'mysql');  //Database 1
$pdo2 = new PDO('mysql:host=localhost;dbname=databaseB', 'root', 'mysql');  //Database 2

$sql = "SELECT a.userID, b.usersFirstName, b.usersLastName  FROM databaseA.dbo.TableA a inner join database B.dbo.TableB b  ON a.userID=b.userID";

foreach ($pdo->query($sql) as $row) {



$jo1 = $row['userID'];
$jo2 = $row['usersFirstName'];


}
?>
 
Last edited:

Forum statistics

Threads
69,477
Messages
909,882
Members
239,664
Latest member
شاكر

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu