如何在另一个页面中导入数据库连接

I'm new to php and i want to import the db-connection details from Db.php to the other page but it's not working.

If code require setup database connection each page

$bd=mysqli_connect("localhost","root","","dbgadget");

Please help me or give an example how i could access the db-connnection details in other pages.

Db.php

<?php
$mysql_hostname = "localhost";
$mysql_user = "root";
$mysql_password = "";
$mysql_database = "dbgadget";


$bd = mysqli_connect($mysql_hostname, $mysql_user,   
$mysql_password,$mysql_database) ;


if (mysqli_connect_errno())
{
    echo "Failed to connect to database: " . mysqli_connect_error();
}

mysqli_close($bd);
?>

Productdetail.php

<?php
include('db.php');

$prodID = $_GET['prodid'];

if(!empty($prodID)){
    /// if i uncoment this line then code work fine 
    $bd=mysqli_connect("localhost","root","","dbgadget");

    $sqlSelectSpecProd = mysqli_query($bd,"select * from products where id = 
     '$prodID'");
    $getProdInfo = mysqli_fetch_array($sqlSelectSpecProd);
    $prodname= $getProdInfo["Product"];
    $prodcat = $getProdInfo["Category"];
    $prodprice = $getProdInfo["Price"];
    $proddesc = $getProdInfo["Description"];
    $prodimage = $getProdInfo["imgUrl"];
}
?>

you seem to be closing your database connection in the db.php file. try removing this line and then re-adding it at the very end of your code in productdetail.php