I am having difficulty connecting twice to my database, each time I connect to a table the code and the following:
Categories
<!-- Portfolio Grid -->
<section class="bg-light" id="portfolio">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading text-uppercase">Categorias</h2>
<h3 class="section-subheading text-muted"></h3>
</div>
</div>
<div class="row">
<?php
require_once "conecta_db.php"; //CHAMA O ARQUIVO DE CONEXÃO COM BD
$tb = "categorias";
$sql = "SELECT * FROM ".$tb;
$result=mysqli_query($con,$sql);
while($linha = mysqli_fetch_assoc($result))
{
?>
<div class="col-md-4 col-sm-6 portfolio-item">
<a class="portfolio-link" href="<?php echo "categorias.php?idcat=".$linha["idcat"];?>">
<div class="portfolio-hover">
<div class="portfolio-hover-content">
<i class="fa fa-plus fa-3x"></i>
</div>
</div>
<div class="portfolio-caption">
<h4><?php echo utf8_encode ($linha["nome"]); ?></h4>
<?php echo "<img class=\"img-fluid\" src=\"img/servicos/".$linha["idcat"].".png\">"; ?>
<p class="text-muted"><?php echo utf8_encode ($linha["descricao"]);?></p>
</div>
</a>
</div>
<?php } // fecha while
// Free result set
mysqli_free_result($result);
mysqli_close($con);
?>
</div>
</div>
</section>
<section class="bg-light" id="servicos">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading text-uppercase">Serviços</h2>
<h3 class="section-subheading text-muted"></h3>
</div>
</div>
<div class="row">
<?php
require_once "conecta_db.php"; //CHAMA O ARQUIVO DE CONEXÃO COM BD
$tbb = "servicos";
$sqll = "SELECT * FROM ".$tb;
$resultt=mysqli_query($con,$sql);
while($linha = mysqli_fetch_assoc($resultt))
{
?>
<div class="col-md-4 col-sm-6 portfolio-item">
<a class="portfolio-link" href="<?php echo "categorias.php?idcat=".$linha["idsv"];?>">
<div class="portfolio-hover">
<div class="portfolio-hover-content">
<i class="fa fa-plus fa-3x"></i>
</div>
</div>
<div class="portfolio-caption">
<h4><?php echo utf8_encode ($linha["nome"]); ?></h4>
<?php echo "<img class=\"img-fluid\" src=\"img/sv/".$linha["idsv"].".png\">"; ?>
<p class="text-muted"><?php echo utf8_encode ($linha["descricao"]);?></p>
</div>
</a>
</div>
<?php } // fecha while
// Free result set
mysqli_free_result($result);
mysqli_close($con);
?>
</div>
</div>
</section>