DB 1:
<?php
$servername = "localhost";
$dbname = "root";
$dbpassword = "";
$name = "one";
$db_one = new mysqli($servername, $dbname, $dbpassword, $name);
if ($db_one->connect_error) {
die("We are likely experiencing a heavy traffic load, please come back later!");
}
?>
DB 2:
<?php
$servername = "localhost";
$dbname = "root";
$dbpassword = "";
$name = "two";
$db_one = new two($servername, $dbname, $dbpassword, $name);
if ($db_one->connect_error) {
die("We are likely experiencing a heavy traffic load, please come back later!");
}
?>
My Attempted Code:
<?php require("db.php"); ?>
<?php //Select All Orders
$stmt = $db_one->prepare("SELECT * FROM `one`");
$stmt = $db_one->prepare("SELECT * FROM `one_table2`");
$stmt = $db_two->prepare("SELECT * FROM `two`");
$stmt->execute();
$result = $stmt->get_result();
if($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo $one[] = "<tr><td>".$row["fromdbone"]."</td>";
echo $two[] = "<td>".$row["fromdbtwo"]."</td>";
echo $three[] = "<td>".$row["fromdbone_table2"]."</td></tr>";
}
}
$stmt->close();
?>
Hey everyone I am at a loss here, how exactly would I go about executing multiple querys from different tables and databases in order to put it all into one table?
Thanks so much for your insight I trust you are all a lot smarter than me!
EDIT: Or if I was to do multipe querys, how would I get them all into one HTML table?
Thanks, I have been trying to figure this out for hours so I hope you can help!